Wednesday, December 21, 2016

Web config for basicHttpBinding for windows authentication only with errors. solved

List of web.config error in WCF.

Below is the process 

Use basicHttpBinding with Windows Authentication and TransportCredentialOnly in WCF from Windows Forms.

I checked so many solution and found the final solution.

1. The provided URI scheme 'https' is invalid; expected 'http'.

2. Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

Below is the correct web.config file. and tested by me.
<bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding2">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="MyTestServicesProject1.MyTestService">
        <endpoint  binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding2"
          name="BasicHttpEndpoint" contract="MyTestServicesProject1.IMyTestService">         
        </endpoint>       
      </service>
    </services>
    <behaviors>

Note:

1. In the Service name tag attribute (<service name="") name must be followed by project name and service name(Interface name without I). Not interface Name.

2. In the endpoint tag (<endpoint  ), Contract must be project name and then Interfacename(Including I).

3. We can also put address="" attribute value to blank for windows authentication with http.
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBindin

No comments:

Post a Comment