At this moment I am teaching a class on team system. This is a three day training where we touch all the aspects of team system. During the course we use a web application that calls a web service to get a list of information. Perhaps you have heard of the sample application I am using, it is called Camino.
I am running this on a single server setup of team system. Because I wanted to try if all works fine on the latest service packs I installed Team System on a Windows 2003 server with SP1 applied. (See my previous posts on fixing other problems with this install)
When I tried to fire up the website I noticed I got an exception when the generated proxy from the web reference is called. I always get the error 401: unauthorized.
After spending several hours and consulting a few colleagues of mine I almost gave up, but then I found this nifty check box that helps you tweak the security settings of the Casini server that is used in visual studio 2005. In the properties of the web service project you will find under the Start Options the NTLM Authentication check box.
The problem is caused by the fact that the casini webserver that serves the requests uses NTLM to validat the user. Generated proxies (e.g. from a webreference) don’t use the default credentials of the process to satisfy the NTLM handshake. The way to fix this is to set the property UseDefaultCredentials=true;. This makes the proxy using the credentials of the process. You can also turn the NTLM check box of, that will work as well.