Friday, July 30, 2010 | |
Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...
Location: BlogsRT-blog    
Posted by: Ron Smith 1/8/2009 4:10 PM

My dev server is a Win 2003 machine with IIS 6.0.  I've got a number of web sites set up which I reference via URLs such as http://site1.localhost, http://site2.localhost, etc.  By putting entries in my HOSTS file which point back to 127.0.0.1, I can use those URLs to access the sites because I set up Host Headers for each site to look for its specific URL.

After installing VS 2008, I suddenly lost the ability to debug web applications on my local machine.  I had been using VS 2005 successfully before that.

"Unable to start debugging on the web server. An authentication error occurred while communicating with the web server."

I did a lot of fruitless searching on the web.  None of the solutions worked: Integrated Windows Authentication must be enabled for the website - yes it was. ASP.Net security settings all checked out.  ACL's were all okay.  I found that if I disabled Anonymous logins for the website in IIS, I could see that Integrated Windows Authentication wasn't working properly.  When viewing the site in my browser I would be asked to log in, but my windows credentials would not work*. Arg!

After examining IIS log files, it was clear that Visual Studio was trying to log in to the web server using the same account I was logged into Windows with.  So we were both having the same problem. For some reason IIS wasn't handling IWA properly.

I turned on auditing for logon failures and examined the security event log.

Hmm, this is interesting:

Event Type: Failure Audit
Event Source: Security
Event Category: Logon/Logoff
Event ID: 537
Date:  1/8/2009
Time:  12:56:45 PM
User:  NT AUTHORITY\SYSTEM
Computer: ISIS
Description:
Logon Failure:
  Reason:  An error occurred during logon
  User Name: administrator
  Domain:  isis
  Logon Type: 3
  Logon Process: ÈùÈ
  Authentication Package: NTLM
  Workstation Name: ISIS
  Status code: 0xC000006D
  Substatus code: 0x0
  Caller User Name: -
  Caller Domain: -
  Caller Logon ID: -
  Caller Process ID: -
  Transited Services: -
  Source Network Address: 127.0.0.1
  Source Port: 4869

Well, no, it isn't that interesting, but the error code led me to this explanation:

You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or IIS 6

As it turns out, Windows Server 2003 Service Pack 1 (SP1) has a loopback check security feature.  Since I was browsing locally and using host headers to access my websites, Windows was refusing to validate the request  (or something like that).

After following the instructions for the workaround, VS debugging works fine now.  I felt I needed to connect the dots here because my initial searches didn't turn up this solution.

*This had been a problem prior to intalling VS 2008, but I was able to work around it by enabling anonymous access to the websites.

Permalink |  Trackback

Comments (5)   Add Comment
Re: Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...    By Sheff on 2/25/2009 10:11 AM
I have searched high and low to solve this issue all day and finally this worked. Great post. Nice one!

Re: Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...    By Kis Söder on 4/28/2009 1:09 PM
F*ck Microsoft and their little surprises in the form of minor changes in paradigm that stops something important without ANY pointers as to what the solution is. All hail the Ron!

Re: Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...    By Alexandros on 7/22/2009 9:35 AM
The problem is that this work around, will most probably cause other bugs in when future hot fixes or service packs are installed on the server since it needs to change a fairly important setting in the registry... sniff :(

Re: Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...    By David LeBlanc on 9/1/2009 9:54 AM
Hi Ron,<br><br>I too follow the same method as yourself for making alternate site roots (test1.localhost, test2.localhost, etc.). Ran into this problem today and wound up hear after searching on google.<br><br>Thanks for the tip. Worked like a charm. I used method 2 to disable the auto-loopback check.

Re: Visual Studio 2008: Unable to start debugging on web server. An authentication error occurred...    By Cameron on 10/8/2009 6:58 AM
What made this that much stranger is that it was totatly out of the blue (one day it works the next day it quit working). Method 1 was the solution for me.<br><br>Thanks Ron!


Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 
Search
Archive
Copyright 2009 Real Technology | Terms Of Use | Privacy Statement Home | RT-Blog | Contact Us | About RT