views:

1095

answers:

6

I get error message "Unable to start debugging on the web server" in Visual Studio 2010. I clicked the Help button and followed the related suggestions without success.

This happens with a newly created local ASP.Net project when modified to use IIS instead of Cassini (which works for debugging). It prompts to set debug="true" in the web.config and then immediately pops up the error. Nothing shows up in the Event Viewer.

I am able to attach to w3wp to debug. It works but is not as convenient as F5.

I also have a similar problem with VS2008 on the same PC. Debugging used to work for both.

I have re-registered Framework 4 (aspnet_regiis -i). I ran the VS2010 repair (this is the RTM version). I am running on a Windows Server 2008 R2 x64 box.

I do have Resharper V5 installed.

There must be some configuration setting or registry value that survives the repair causing the problem.

I'd appreciate any ideas.

Thanks, Gary Davis ([email protected])

A: 

You can firstly deploy your web application/site with your iis, then open your visual studio 2010. Then click "File"->open->website->Local IIS Site, then select your website/application. Then you will find that the debug may works. This method works for my case.

sky100
A: 

I don't have a definite answer though these articles may have some helpful info:

Using Windbg to start with w3wp.exe This mentions windbg/cdb debuggers specifically, but this advice should work with Visual Studio talking to cdb (which is attached to w3wp).

Remote debugging with Visual Studio The reason I mention remote debugging at all is that I had to use that a few times in the past to get Visual Studio to attach to w3wp.exe. W3wp.exe runs in a different session, so you can't directly attach a debugger to that.

Chris O
A: 

You have not mentioned what operating system you are using. But this might not be related to operating system. I am taking a guess here. If you are running on Windows 7, try running visual studio under Administrator previlages.

You can also try adding your user ID to the VS debugger users group. You can access user groups by reight clicking on computer name or my computer and selecting Manage. Under that you can find Users & Groups.

Nilesh Gule
I am using Windows Server 2008 R2. I tried running VS2010 as admin and that did not help. I looked at the groups on my system and there is no group called VS debugger or anything similar. I am a member of the Administrators group. Thanks.
GarDavis
+3  A: 

Disable the loopback check

(original microsoft page here)

To set the DisableLoopbackCheck registry key, 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

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, and then restart your computer.

Jeroen
Jeroen - this worked! Thanks!Being lazy, I did not reboot. I tried to debug the existing VS2010 web app and still got the error. I shut down VS2010 and then killed the msvsmon.exe process; reopened VS2010 with the project and this time was able to debug.
GarDavis
You're welcome. dont forget to accept the answer (and upvote)
Jeroen
Turns out it is still failing after working a bit so I am still looking for a solution. Now, killing msvsmon and restarting VS2010 did not help.
GarDavis
A: 

Your solution file in visual studio is broken. It's a known issue when converting from a file-system website to an IIS website, and it has been carried over from 2008 to 2010. Not sure of the location for the bug report on ms's kb site, though.

Remove the website from the solution file (right click the project name, click "remove"). Then right click the solution name, click "add existing web site". When the dialog to add a web site comes up, choose "from IIS" in the left-hand pane. Navigate to your application in IIS, select "use secure sockets layer" if necessary, and click "finish" (or whatever that button is labeled).

this will permanently fix the issue.

Will
This is not my solution. Even winforms apps and console apps refuse to debug with the same error; not just asp.net sites. At least with asp.net, I have the workaround to attach to w3wp. Note that this is not consistent - infrequently the F5 will start up the debugger but usually, I just get the error Unable to Start Debugging.... For the Console App, the error is a bit different: "Error while trying to run project: Unable to start debugging".
GarDavis
A: 

In IIS in the Directory Security TAB, if using SSL check "Ignore client certificate" if you are running it in your local PC.

Ioannis Suarez
The error happens for WinForms apps, not just ASP.Net. So there is no tie-in to IIS.
GarDavis
If I put a Thread.Sleep(100000) in the start code and set it running, then attempt to attach the debugger to the process, the error that displays is "Unable to attach to the process".
GarDavis
Well, I created a new console app from scratch and the debugger worked. I copied in the source code from the failing project and it also worked. I compared the csproj files and saw the one that worked used Client Framework 4 instead of Framework 4 but switching that did not get it to work. Another difference was the working project used X86 instead of Any CPU. My system is 64-bit. Switching this setting did get the console app to debug! Well, now I will have to check ASP.Net and see if that is the solution also. Not sure what the real solution is, however since Any CPU should debug.
GarDavis