b

Wednesday, 9 May 2012

Basic Authentication in IIS host WCF service

Step 1)   Create  WCF Service
Step 3)   Host in IIS 7.0
Step 4)  Open Web.confg file

Add following code . i.e Transport credentials with basic authentication.


    <bindings>
      <basicHttpBinding>
        <binding name="Basicone">
          <security mode="Transport">
            <transport clientCredentialType="Basic"></transport>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

Provide this binding name in Service endpoint section 

<endpoint contract="ur choice" binding="basicHttpBinding" bindingConfiguration="Basicone"></endpoint>


Note: For Adding SSL certicate /Hosting WCF service in IIS.Please refer other articles.

Before Testing , Disable Anonymous Authentication, Enable Basic Authentication,  As shown below


     In this  Select  WCF Site i.e WCFOne(in this case)--> Features View-->in IIS category(Authentication)--> Double Click on it. 

Here  1)Disable Anonymous Authentication (i.e Disable)
          2) Enable Basic Authentication . 


No comments:

Post a Comment