Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting programmatic configuration of WCF service to config file
    text
    copied!<p>I have written a simple WCF web service which is configured programmaticaly. It exposes three endpoints which bind different bindings to the same contract:</p> <ul> <li>WebHttpBinding</li> <li>WebHttpRelayBinding (over Microsoft azure)</li> <li>myBinding (self-made binding in an additional DLL)</li> </ul> <p>The configuration code is pretty straight-forward at the moment:</p> <pre><code>WebServiceHost host = new WebServiceHost( typeof(MyService), new Uri("http://localhost:80/")); host.AddServiceEndpoint(typeof(MyService), new WebHttpBinding(), ""); ServiceEndpoint sbEndpoint = host.AddServiceEndpoint( typeof(MyService), new WebHttpRelayBinding(), "http://azureURL"); TransportClientEndpointBehavior sbBehavior = new TransportClientEndpointBehavior(); sbBehavior.CredentialType = TransportClientCredentialType.UserNamePassword; sbBehavior.Credentials.UserName.UserName = "azureUserName"; sbBehavior.Credentials.UserName.Password = "azurePassword"; sbEndpoint.Behaviors.Add(sbBehavior); host.AddServiceEndpoint(typeof(MyService), new MyBinding(), "http://someURL"); host.Open(); </code></pre> <p>Now I want to export this configuration in a config file since I want to be able to change it without having to recompile.</p> <p>My questions at this moment are:</p> <ul> <li>Where can I find valuable information to achieve my goal? Most sites just speak about SOAP bindings - no word about how to include a non-standard binding.</li> <li>Do I have to change MyBinding in order to accept configuration via app.config or does the ServiceModel call it exactly like my programmatic approach does when the config is fine?</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload