本文介绍了Web服务使用Windows身份验证与SOAP客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要访问与交流#窗体应用程序一个Web服务。
I need to access a webservice from a c# forms app.
Web服务需要Windows身份验证。
The webservice needs Windows Authentication.
我用下面的代码:
ServiceDeskSoapClient sd = new ServiceDeskSoapClient();
sd.ClientCredentials.UserName.UserName = @"mydomain\myusername";
sd.ClientCredentials.UserName.Password = "mypassword";
sd.MyMethod();
但得到以下错误:
But get the following error:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
我如何正确设置凭据,以便它使用Windows验证,而不是匿名?
How do I correctly set the credentials so it uses windows auth, not anonymous?
推荐答案
请参阅的,了解如何设置客户端凭据
See How to: Specify Client Credential Values to learn how to set client credentials.
这篇关于Web服务使用Windows身份验证与SOAP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!