4
我在本地运行一个Web服务,连接到我无权访问的外部服务器。Web服务401:未经授权的错误
即使测试凭证由此Web服务的管理员确认完全正确,我仍然收到“401:未授权”错误。
我是否需要调整任何IIS设置?
下面是错误的截图。
// Webservice
IdentityService ws = new IdentityService();
// Test Static Credentials
string username = "twfnf";
string password = "testme99";
string domain = "testapps1";
NetworkCredential credentials = new NetworkCredential(username, password, domain);
CredentialCache credCache = new CredentialCache();
credCache.Add(new Uri(ws.Url), "Basic", credentials);
ws.Credentials = credCache;
ws.PreAuthenticate = true;
ws.AuthenticateUser();
是'IdentityService`一个SOAP风格的Web服务(如WCF Web服务,默认情况下)或更早的.NET 2.0 ASMX web服务? – 2011-12-15 18:01:29