SharePoint Web Service Reference: Authentication Error
On my newly created virtual machine I started working on a web services project and encountered a problem I almost forgot about. When adding a SharePoint web service reference in Visual Studio I was prompted for my credentials, yet being unable to add the reference. Here is what I’ve done to solve the issue.
Introduction
My setup is as follows:
- Virtual machine: Windows Server 2003 Standard
- Host name: vmwin2k3 (no Active Directory involved)
- HOSTS file entry: 192.168.0.100 dev.vmwin2k3
- Web Application URL: http://dev.vmwin2k3 (via host headers)
When I tried adding a web service reference in Visual Studio 2008 I was prompted for my credentials:
Pressing Cancel repeatedly revealed an error that should actually not have come up:
The Solution
To remidy the issue I was forced to dig a bit deeper. There exists a knowledge base article (KB896861) over at Microsoft.com. Basically, it describes how a loopback check introduced with Windows Server 2003 SP1 prevents yourself from authenticating against the host when using a FQDN or custom host header:
Windows XP SP2 and Windows Server 2003 SP1 include a loopback check security feature that is designed to help prevent reflection attacks on your computer. Therefore, authentication fails if the FQDN or the custom host header that you use does not match the local computer name.
All we need to do is to fire up regedit and specify a list of host names (host header values) we are using in order to make authentication work properly:
- Open the registry editor (regedit.exe)
- In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 - Right-click MSV1_0, point to New, and then click Multi-String Value.
- Type BackConnectionHostNames, and then press ENTER.
- Right-click BackConnectionHostNames, and then click Modify.
- In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
- Quit Registry Editor, and then restart the IISAdmin service.
Note: it is mandatory to restart the IISAdmin service. An iisreset won’t do it.
Authentication against the SharePoint web service should work like charm.



