I need to access a webservice from a c# forms app.
The webservice needs Windows Authentication.
I use the following code:
ServiceDeskSoapClient sd = new ServiceDeskSoapClient();
sd.ClientCredentials.UserName.UserName = @"mydomainmyusername";
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'.
How do I correctly set the credentials so it uses windows auth, not anonymous?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…