Unauthorized 401.1 Exception when calling Web Services in Windows SharePoint Services 3.0

This post is a small reminder to myself for the next time I may run into this problem when working with WSS 3.0 Web Services interface. Hopefully it might also save someone else a huge amount of time if they have a similar problem (A lot of time was wasted for me until I finally found the answer, which turned out to be not so obvious).

I had developed a web application which basically interfaces the Lists service in Windows SharePoint Services using a standard SOAP call. It worked well for ages, and then all of a sudden it started to throw a Web Exception when the application went to talk to SharePoint. Due to the nature of the Exception, one would think the problem is some what related to Security.. of course this caused me to spend hours on checking what might have changed from a security context in the network which might have caused the application to break.

Until I discovered that the .NET Framework 3.5 SP1 had a small security change in it. Small enough to miss, big enough to cause an application to break!! .. After checking the date which the SP1 was installed on the server lead me to believe this is what broke the Web Services calls. Problems were first reported at the same time as this Service Pack was loaded.

So what changed? Well according to Microsoft, a Loopback check was implemented in the .NET 3.5 SP1 update which will cause a web server to perform a Loopback lookup when performing web service calls; I guess in a security sense this might be smart, so applications can’t masquerade themselves from unknown sources. Basically it checks to see if the web servers NETBIOS name matches the host header from the web application. Great idea when applications run as the server name, or when a server hosts a single web site with an unassigned host header value (SharePoint configures this way out of the box). But in my case the Web Application I wrote ran as an alias on a Front-End web server that hosted multiple web applications. This Loopback check is not something specific to SharePoint, but rather a check IIS will do for all applications.

If your running WSS 3.0 in a farm configuration with load balancing configured then this will mean you also will likely experience the same dramas with SOAP Calls. Keep in mind that all front-end web servers who have the .NET Framework 3.5 SP1 installed will need to have this fix applied as you can not be sure which one will serve the Web Service call/request from your Application (in Load Balanced environments).

Web Exception that I was getting from my Application:

Type: WebException, Exception Message: The request failed with HTTP status 401: Unauthorized.

Solution:

The fix is simple; disable this new loopback check introduced in .NET Framework 3.5 Service Pack 1.

Follow the methods in this Microsoft KB Article: http://support.microsoft.com/kb/896861

Rating 3.00 out of 5

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top