Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>I want to secure some endpoint of a WCF service, i dont know if you can secure some endpoint and some not.</p> </blockquote> <p>Sure - you just need to create two separate binding configurations, and use one on those endpoints that are secured, the other on the others:</p> <pre><code>&lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="secured"&gt; &lt;security mode="Message"&gt; &lt;message ...... /&gt; &lt;/security&gt; &lt;/binding&gt; &lt;binding name="unsecured"&gt; &lt;security mode="None" /&gt; &lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;services&gt; &lt;service name="WindowsFormsApplication11.WmsStatService" behaviorConfiguration="mex"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://192.168.0.199:87" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="/Secured/Test" binding="basicHttpBinding" bindingConfiguration="secured" contract="WindowsFormsApplication11.IWmsStat" behaviorConfiguration="MyServiceBehavior" /&gt; &lt;endpoint address="/Unsecured/Test" binding="basicHttpBinding" bindingConfiguration="unsecured" contract="WindowsFormsApplication11.IWmsStat" behaviorConfiguration="MyServiceBehavior" /&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; </code></pre> <p>Marc</p> <p>PS: not sure if that's just a problem with your postings not being up to date anymore - have you noticed, that you have two separate behavior configurations:</p> <pre><code>&lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="mex"&gt; &lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&gt; &lt;/behavior&gt; &lt;behavior name="MyServiceBehavior"&gt; &lt;serviceCredentials&gt; &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WindowsFormsApplication11.CustomValidator, CustomValidator" /&gt; &lt;/serviceCredentials&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; </code></pre> <p>and your service is only referencing the "mex" behavior? That means, your service is indeed using the <code>&lt;serviceMetadata&gt;</code> behavior - but <strong>NOT</strong> the <code>&lt;serviceCredentials&gt;</code> one!</p> <p>You need to merge these into one and then reference just that:</p> <pre><code>&lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="Default"&gt; &lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&gt; &lt;serviceCredentials&gt; &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WindowsFormsApplication11.CustomValidator, CustomValidator" /&gt; &lt;/serviceCredentials&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;services&gt; &lt;service name="...." behaviorConfiguration="Default" </code></pre> <p>Marc</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