Reputation: 1646
I have a web service that is hosted in a clustered environment. The web application that is calling this service is also hosted in a clustered environment, but on a different set of IIS6 servers. Hence, the application servers are appserv1 and appserv2 and the service servers are svcserv1 and svcserv2. We don't control which servers are accessed since we typically just refer to them as either appserv or svcserv, respectively.
The service is a WCF Service but has been created to be compatible with the .Net 2.0 Web Service framework. The application runs fine, when it runs, but probably > 35% of the time the service responds with an Exception: The request failed with HTTP status 401: Unauthorized. error.
I've seen others that recommend setting the credentials directly and my application is doing this as follows.
Dim cc As New CredentialCache()
Dim service As WCFServiceRef.Reports
service = New WCFServiceRef.Reports
service.Url = serviceURL
cc.Add(New Uri(service.Url), "Negotiate", New NetworkCredential("username", "password"))
service.Credentials = cc
reportData = service.GenerateReport(reportid, True, parameters, "PDF", Environment)
I have also tried to directly access the individual servers by changing the reference URLs to bypass the load manager and go directly to the domain name for the server but this hasn't made any difference.
I have also seen this MSDN KB article but since I don't directly have access to the server configuration (and it's difficult to get anything changed) I wanted to be sure there isn't something I can do from the application side. Note that the server has been configured for Windows Authentication and does not allow anonymous access.
Thanks!
Upvotes: 1
Views: 8688
Reputation: 29664
Another thing to consider:
Do you need sticky sessions? Are there servers that are recycling too often?
There's a whole bunch of reasons why you may be getting 401s, so you'll just have to dig around and find out what's going on.
Upvotes: 0
Reputation: 580
A lot of this depends on whether your authentication attempts are using Kerberos or falling back to NTLM. I would suggest using a tool like Fiddler to capture packets being sent from your app server to validate what authentication protocol is being used.
If you find you're using Kerberos, here's a few things to try:
Hopefully that helps a bit. If you're using NTLM then I unfortunately don't have many ideas as I'm used to working in Kerberos-only environments.
Upvotes: 2
Reputation: 65461
First thing is to check the IIS logs on each machine and see if the 401 errors are coming from a single machine.
The next thing to check is if the 401's are related to specific urls.
Upvotes: 1