Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all - yes you can! It depends on whether you use Transport or Message binding - if you're internet-facing, you're more likely to use message-based security.</p> <p>Unfortunately, for message-based security, basicHttpBinding only supports certificates which is a bit of a pain.</p> <p>wsHttpBinding on the other hand would support username/password or other methods as well.</p> <p>You'd configure wsHttpBinding with username/password client credentials over message-based security like this:</p> <pre><code> &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="wsUserName"&gt; &lt;security mode="Message"&gt; &lt;message clientCredentialType="UserName"/&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;services&gt; &lt;service name="yourservice"&gt; &lt;endpoint name="YourEndpoint" address="" binding="wsHttpBinding" bindingConfiguration="wsUserName" contract="IYourService" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;/system.serviceModel&gt; </code></pre> <p>The section under <code>&lt;bindings&gt;</code> defines a <strong>binding configuration</strong> for wsHttpBinding that uses message-security with username/password client credentials.</p> <p>The section under <code>&lt;service&gt;</code> defines a sample service that uses wsHttpBinding and that references that binding configuration that we just defined.</p> <p>On the server side, you could now use the username/password that's being sent over the wire to validate your callers either in your Active Directory (everyone calling needs an AD account with you), or in the ASP.NET membership system database; or if you really really must, you could write your own authentication mechanism, too.</p> <p>Find a lot of useful information on WCF <a href="http://wcfsecurity.codeplex.com/wikipage?title=How%20Tos&amp;referringTitle=Home" rel="nofollow noreferrer">security at Codeplex</a> - excellent resource.</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