none
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate'

    Question

  • Hi ,
    I got an error when I try to test WCF transport security mode with  windows authentication using WSHTTPBinding.:

    The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate'
    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    Tuesday, August 11, 2009 7:29 AM

Answers

  • Hi Frank Xu Lei ,

    It should be an authentication error , you can check your service configuration and client credential code first.

    For the client credential , as you are using the Windows authentication , please check your code as following :


    ServiceClient client = new ServiceClient("Default_IService");
    client.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
    client.ClientCredentials.Windows.ClientCredential.Password = "Passowrd";
    client.ClientCredentials.Windows.ClientCredential.Domain = "DomainName";
    client.Open();
    client.DoWork();
    client.Close();

    If both WCF service configuration and client configuration is corrent and it still doesn't work , it should be caused by these possible reasons :

    =======================================

    1). Is you are hosting your WCF service on IIS , please check is the Windows Credential is enabled on IIS.

    2). Check the account you use for the authentication is existed and actived on the server.

    3). There will be an error encountered after upgrade your server to .NET Framework 3.5 SP1 , you can fix the issue by inserting the <identity> tag into <endpoint> tag like this:

    <endpoint address="" binding="wsHttpBinding" contract="ServiceHost.IService">
          <identity>
                <servicePrincipalName value=""/>
          </identity>
    </endpoint>
    For this kind of issue , you can refer to :

    .NET 3.5 SP1 Breaking Change to WCF

    http://msmvps.com/blogs/alvin/archive/2008/11/14/net-3-5-sp1-breaking-change-to-wcf.aspx

    =======================================

    Hope these will help you , if the issue still existed after you take these works , please show me your service configuration and the client code for the service calling , I will try to help you to figure out the root cause.

    Thanks , Quan



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, August 12, 2009 8:19 AM
  • Hi,
       Thanks for your replay.
       It is  really helpful.
       But actually,It was an error which was caused by WSHttpBinding.
       I configed the Host with  WSHttpBinding.WSHttpBinding has 'Negotiate' setting.
       I forot to change it to NetTcpBinding.
       The Client use NetTcpBinding to call the Service .
       So after I updated the Host config file and rebuild the host project.start host app again.
      The error disappeared.
      Thanks a lot.
      
    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    Tuesday, August 18, 2009 12:43 PM

All replies

  • Hi Frank Xu Lei ,

    It should be an authentication error , you can check your service configuration and client credential code first.

    For the client credential , as you are using the Windows authentication , please check your code as following :


    ServiceClient client = new ServiceClient("Default_IService");
    client.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
    client.ClientCredentials.Windows.ClientCredential.Password = "Passowrd";
    client.ClientCredentials.Windows.ClientCredential.Domain = "DomainName";
    client.Open();
    client.DoWork();
    client.Close();

    If both WCF service configuration and client configuration is corrent and it still doesn't work , it should be caused by these possible reasons :

    =======================================

    1). Is you are hosting your WCF service on IIS , please check is the Windows Credential is enabled on IIS.

    2). Check the account you use for the authentication is existed and actived on the server.

    3). There will be an error encountered after upgrade your server to .NET Framework 3.5 SP1 , you can fix the issue by inserting the <identity> tag into <endpoint> tag like this:

    <endpoint address="" binding="wsHttpBinding" contract="ServiceHost.IService">
          <identity>
                <servicePrincipalName value=""/>
          </identity>
    </endpoint>
    For this kind of issue , you can refer to :

    .NET 3.5 SP1 Breaking Change to WCF

    http://msmvps.com/blogs/alvin/archive/2008/11/14/net-3-5-sp1-breaking-change-to-wcf.aspx

    =======================================

    Hope these will help you , if the issue still existed after you take these works , please show me your service configuration and the client code for the service calling , I will try to help you to figure out the root cause.

    Thanks , Quan



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, August 12, 2009 8:19 AM
  • Hi,
       Thanks for your replay.
       It is  really helpful.
       But actually,It was an error which was caused by WSHttpBinding.
       I configed the Host with  WSHttpBinding.WSHttpBinding has 'Negotiate' setting.
       I forot to change it to NetTcpBinding.
       The Client use NetTcpBinding to call the Service .
       So after I updated the Host config file and rebuild the host project.start host app again.
      The error disappeared.
      Thanks a lot.
      
    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
    欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
    欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
    欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
    Tuesday, August 18, 2009 12:43 PM