Uncategorized

Unable to attach to process (on localhost)

Another interesting one I got a few days ago: after installing the SP1 for Visual Studio 2003, the customer was unable to debug his web application (on localhost) neither pressing F5 nor attaching to the target w3wp.exe process. As you can imagine, removing SP1 the problem disappeared. Moreover they had multiple machines running the same OS and software that worked fine, only one particular machine was affected by this problem; more interestingly, other developers were able to remotely debug their application hosted on the affected server, so only debugging on localhost was not working (WinForm debugging was also working fine). Of course the account used to login on the server was a local administrator.

The target platform we were running on was Windows Server 2003 R2 x64 on AMD Operton 280 (dual core, 2.4GHz) with 4GB RAM; IIS is configured to run in 32 bit mode (w3svc/AppPools/Enable32bitAppOnWin64 = TRUE), and of course Visual Studio .NET 2003 with Service Pack 1.

To start troubleshooting this I did a quick research in our internal docs and it turner out that his is a known issue due to loopback check; basically the reason is because the underlying DEBUG request is getting a 401 response, causing the debugger to fail. There are two options to resolve this problem:

Method 1: Disable the loopback check

  • Click Start, click Run, type regedit, and then click OK
  • In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  • Right-click Lsa, point to New, and then click DWORD Value
  • Type DisableLoopbackCheck, and then press ENTER
  • Right-click DisableLoopbackCheck, and then click Modify
  • In the Value data box, type “1“, and then click OK
  • Quit Registry Editor

Method 2: Specify host names

To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:

  • Click Start, click Run, type regedit, and then click OK
  • 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

The customer applied the first method and then happily started debugging his application 😊

Cheers

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.