2

I already spent so much time trying to figure out what the problem is. I am getting this error when consuming WCF service from a desktop console application. The service works fine when access from a browser with silverlight client.

Error Message:

System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'.

I don't understand why it doesn't work even if both client and server have same authentication scheme 'Negotiate'. I am getting HTTP 401.

I verified client and server configuration is correct, because it works in silverlight client using the same client configuration.

IIS7 website is configured with Windows Authentication using providers 'Negotiate,NTLM'.

So, what does this error message mean? :(

Ross Brigoli
  • 676
  • 1
  • 12
  • 22
  • The error is implying that your console app is accessing the WCF service as an anonymous user but the service is configured to only allow Windows authentication. Could you add the WCF service configuration (the system.serviceModel element from web.config/app.config file or the code if configuring dynamically) and your console app.config file to your question. – Sixto Saez Mar 08 '12 at 18:01

1 Answers1

0

I have fixed my WCF issue by setting client security.
client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;