Friday, December 2, 2016

WCF Error

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.


Solved
refered url:https://msdn.microsoft.com/en-us/library/ff648505.aspx
http://www.c-sharpcorner.com/uploadfile/Mahadesh/wcf-series-using-the-wcf-service-configuration-editor/
http://stackoverflow.com/questions/2435823/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via

Tools:
Microsoft Service configuration editor.

Step 2: Configure the WCF Service to Use basicHttpBinding

In this step, you configure your WCF service endpoint to use basicHttpBinding.
  1. Right-click the Web.config file of the WCF service and then click Edit WCF Configuration.
    If you do not see the Edit WCF Configuration option, on the Tools menu, click WCF Service Configuration Editor. Close the WCF Service Configuration Editor tool that appears. The option should now appear on the web.config context menu.
  2. In the Configuration Editor, in the Configuration section, expand Service and then expand Endpoints.
  3. Select the first node [Empty Name]. Set the name attribute to BasicHttpEndpoint.
    By default, the name will be empty because it is an optional attribute.
  4. In the Service Endpoint section, set the binding attribute to basicHttpBinding by choosing this option from the drop-down list.
  5. In the Configuration Editor, on the File menu, click Save.
  6. In Visual Studio, verify your configuration settings in Web.config. The configuration should look as follows:
    
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="Service">
        <endpoint address="" binding="basicHttpBinding"
            name="BasicHttpEndpoint"
            bindingConfiguration=""
            contract="IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
           contract="IMetadataExchange" />
      </service>
    </services> 
    
    
    

Step 3: Configure basicHttpBinding to use Windows Authentication with TransportCredentialOnly

By default, the basicHttpBinding security mode is None. This default setting means that you do not have authentication and that neither transport nor message security is enabled. By enabling Windows authentication with TransportCredentialOnly, you will get authentication, but no message protection; this is similar to how an ASMX Web service works.
  1. In the Configuration Editor, in the Configuration section, select the Bindings folder.
  2. In the Bindings section, choose New Binding Configuration.
  3. In the Create a New Binding dialog box, select basicHttpBinding.
  4. Click OK.
  5. Set the Name of the binding configuration to some logical and recognizable name; for example, BasicHttpEndpointBinding.
  6. Click the Security tab.
  7. Set the Mode attribute to TransportCredentialOnly by choosing this option from the drop-down menu.
  8. Set the TransportClientCredentialType to Windows by choosing this option from the drop-down list.
    In this case, the Windows option represents Kerberos.
  9. In the Configuration section, select BasicHttpEndpoint.
  10. Set the BindingConfiguration attribute to BasicHttpEndpointBinding by choosing this option from the drop-down list.
    This associates the binding configuration setting with the binding.
  11. In the Configuration Editor, on the File menu, click Save.
  12. In Visual Studio, verify your configuration, which should look as follows:
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="Service">
        <endpoint address="" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpEndpointBinding"
          name="BasicHttpEndpoint" contract="IService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
            contract="IMetadataExchange" />
      </service>
    </services>
    

No comments:

Post a Comment