Note that there are some explanatory texts on larger screens.

plurals
  1. POSimplified Configuration wsHttpBinding
    text
    copied!<p>I'm having a simple WCF service, deployed to IIS. I used <a href="http://msdn.microsoft.com/en-us/library/ee530014.aspx" rel="nofollow">simplified configuration</a> with <code>BasicHttpBinding</code>, which worked fine. </p> <p>Now I wanted to add Username/Password authentication and used wsHttpBinding. In the document above it is stated: </p> <blockquote> <p>In .NET Framework 4, the element is optional. When a service does not define any endpoints, an endpoint for each base address and contract implemented are added to the service. The base address is appended to the contract name to determine the endpoint and the <strong>binding is determined by the address scheme</strong>.</p> </blockquote> <p>What does this mean, how am I supposed to configure the <code>wsHttpBinding</code> binding by address scheme?</p> <p>My config looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding&gt; &lt;security mode="Message"&gt; &lt;transport clientCredentialType="None"/&gt; &lt;message clientCredentialType="UserName"/&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;serviceCredentials&gt; &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="SampleWebservice.CustomValidator,SampleWebservice" /&gt; &lt;/serviceCredentials&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>This is Windows Server 2008, IIS 7.</p> <p>It seems, the service is not picking up the wsBinding settings, as I can always see a <code>BasicHttpBinding</code> in the downloaded svc-file. Am I missing something? </p> <hr> <p><strong>EDIT</strong></p> <p>I applied the changes suggested by user stevedocious to alter my web.config file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="SampleWebservice.SampleWebservice.Sample" behaviorConfiguration="customServiceBehaviour"&gt; &lt;endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /&gt; &lt;endpoint contract="SampleWebservice.SampleWebservice.ISample" binding="wsHttpBinding" bindingConfiguration="bindingConfiguration" address="" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="bindingConfiguration"&gt; &lt;security mode="Message"&gt; &lt;transport clientCredentialType="None"/&gt; &lt;message clientCredentialType="UserName"/&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="customServiceBehaviour"&gt; &lt;serviceCredentials&gt; &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="SampleWebservice.CustomValidator,SampleWebservice" /&gt; &lt;/serviceCredentials&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>However, the metadata can't be exposed. Checking the service with the browser states, that my metadata publishing is currently disabled. </p>
 

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