none
windows authentication problems - .net 2.0 web Service client to .net 4.5 basicHttpBinding service RRS feed

  • Question

  • Hi,

    I have a self hosted service (below) that use windows authentication. The service is created in a way, so both WFC clients (newer than .net 3.5) and older web services (.net 2.0) may use it.

    The problem is, that I can't figure out how the .net 2.0 webservice should be build to support windows authentication.

    I know it must be a kerberos/ntlm problem since the remote test server isn't trusted - plus - when using a regular wcf client, it first try kerberos and then ntlm next (which is successful).

    The webservice has been created using the menu "Add Web References" and it does work on local services (with authentication) and remote services, if I set the authentication mode to "none".

    Any help would be appreciated.

    BR

    Peter

    <system.serviceModel> <serviceHostingEnvironment /> <behaviors> <serviceBehaviors> <behavior name="SuspendBehavior"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding name="SuspendBinding" > <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" proxyCredentialType="None" /> </security> </binding> </basicHttpBinding> <mexHttpBinding> <binding name="mexBinding" /> </mexHttpBinding> </bindings> <services> <service behaviorConfiguration="SuspendBehavior" name="SuspendService.Service.WCF.WcfService"> <endpoint address="http://localhost:5075/Suspend" binding="basicHttpBinding" bindingConfiguration="SuspendBinding" name="HttpServiceEndpoint" contract="SuspendService.Service.WCF.IWcfService" />

    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="mexBinding" name="mexEndpoint" contract="IMetadataExchange" /> </service> </services> </system.serviceModel>





    Wednesday, September 11, 2013 6:33 AM

Answers

  • Hi,

    If we want to use the BasicHttpBinding for .NET 2.0 client backward compatibility then there are two areas that we need to focus on to enable Windows Authentication in a WCF service, the Web.config file & the service implementation.

    The following article tells the details about how to implement it, please try to refer to:
     
    #WCF BasicHttpBinding with Windows Authentication & a 2.0 Client:
    http://www.schnieds.com/2008/10/wcf-basichttpbinding-with-windows.html .

    Best Regards,
    Amy Peng


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 12, 2013 12:52 AM
    Moderator
  • Hi Amy,

    Thanks for the comments and the link.

    The answer is to change the credentialtype from Windows to Ntlm and add the following line in code:

    service.Credentials = CredentialCache.DefaultNetworkCredentials;
    BR
    Peter
    Thursday, September 12, 2013 8:03 AM

All replies

  • Hi,

    If we want to use the BasicHttpBinding for .NET 2.0 client backward compatibility then there are two areas that we need to focus on to enable Windows Authentication in a WCF service, the Web.config file & the service implementation.

    The following article tells the details about how to implement it, please try to refer to:
     
    #WCF BasicHttpBinding with Windows Authentication & a 2.0 Client:
    http://www.schnieds.com/2008/10/wcf-basichttpbinding-with-windows.html .

    Best Regards,
    Amy Peng


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 12, 2013 12:52 AM
    Moderator
  • Hi Amy,

    Thanks for the comments and the link.

    The answer is to change the credentialtype from Windows to Ntlm and add the following line in code:

    service.Credentials = CredentialCache.DefaultNetworkCredentials;
    BR
    Peter
    Thursday, September 12, 2013 8:03 AM