17

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.

J. Steen
  • 15,470
  • 15
  • 56
  • 63
GarDavis
  • 1,309
  • 3
  • 14
  • 23
  • Are HTTP Keep Alives enabled in IIS? That has caused this for me before. – JasonS May 21 '10 at 21:46
  • Yes, they are enabled. I am still having this problem. It happens in both VS2010 and VS2008. – GarDavis May 25 '10 at 19:11
  • 1
    I'm stuck here too. The only difference is no ReSharper (yet) and no Win 2008 (I'm on Win 7). Have you found a solution? – DMCS Aug 03 '10 at 18:54

27 Answers27

14

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
  • 4,023
  • 2
  • 24
  • 40
  • 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 Aug 06 '10 at 13:21
  • 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 Aug 11 '10 at 16:50
12

I got a new PC with Windows 7. I installed VS2010 and my development environment and hoped my F5 debug problem would be gone, but it still failed to start the debugger.

This was a good clue since it ruled out the install of software.

I finally traced it down to my HOSTS file. I had an entry for some of my local websites which I can access like "http://testsite.lcl" but the IP I had assigned was my machine's IP instead of using 127.0.0.1 so it looked like a remote server to VS2010. Changing back to 127.0.0.1 resolved the issue.

Thanks for everyone's help on this.

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
GarDavis
  • 1,309
  • 3
  • 14
  • 23
10

I had the same problem. How did I fixed it.

Go to IIS (in my case IIS 7 / Windows 7). Select your web site from the list, click on .NET Compilation in ASP.NET section. Select Open Feature. Check if your Debug is set to True. In my case it was False. Once I changed it to True - I have my debug back :)

Alex
  • 101
  • 1
  • 2
  • Ended up fixing it for me as well. The odd thing is, this was set to True before I enabled SSL on the IIS site. Does IIS7 modify your web.config when you enable SSL? – roadsunknown Feb 19 '12 at 20:34
  • 1
    If your APS.NET section is missing see: http://stackoverflow.com/questions/3234930/no-asp-net-features-on-iis-7-5 – Kugel Feb 12 '13 at 01:32
  • this helped me. In trying to do this I found that I had two "compilation" entries in my web.config – lamarant Apr 15 '16 at 18:39
6

These steps my differ depending on your version of Windows. I am using 7 with iis 7.

Open IIS Manager, click on Application Pools and find the 2 ASP.NET v4.0 pools (One is called "ASP.NET v4.0" the other "ASP.NET v4.0 Classic". Chances are that first one is stopped. Do not start it yet, we need to investigate a bit more.

For the "ASP.NET v4.0" pool, check the name in the Identity Field. Is it ApplicationPoolIdentity? Remember the name.

Open Computer Management (right click on My Computer and select Manage). Expand Event Viewer, then Windows Logs. Click on Application and wait for the data to load. There should be an error with a source of User Profile Service with a message that starts with "Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, and that your network is functioning correctly."

If you do find that, then you have the same problem as I did.

The Solution: Go back to IIS Manager and right click on "ASP.NET v4.0" and select Advanced Settings. Under Process Model, the first field is Identity. Change this from ApplicationPoolIdentity to NetworkService. Click OK.

Now start the pool if it did not restart automalically. Go back to your application and press F5 (start debug) and your application should work.

Please note that I have not figured out why this works, and this may be a security risk, but at least you will be able to do some work while you think about this.

Atron Seige
  • 2,783
  • 4
  • 32
  • 39
  • Thanks, this is not my solution - all my pools are "started" – GarDavis May 02 '11 at 13:21
  • This solution worked for me. I had set the identity of the application pool to my Windows account. After changing the password of my account, the debugging stopped working but I hadn't made the connection between the two events. Reading this solution helped me to get back on track. – ConnorsFan Oct 08 '12 at 02:23
  • I had this problem and it turned out that my DefaultAppPool was stopped for some reason. So your answer pointed me in the right direction. Thanks. – Mary Hamlin Nov 13 '12 at 13:49
4

I had this problem in Visual Studio 2012 when running a website I had created in Visual Studio 2010. I tried each of the following, which did not solve the problem, but still may have been required:

  1. Checked that the App Pool was targeted to the same framework as what was specified in the web.config

    <compilation defaultLanguage="c#" debug="true" targetFramework="4.0">
  2. Started the 64bit Remote Debugger: \Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe

  3. Set the DisableLoopbackCheck registry key and restarted Windows. MS Instructions here

  4. Browsed the site locally (it came up just fine).

  5. Finally I found the IIS setting that fixed the issue.

    1. Go to IIS (7.5 in my case) and click on the relevant site in the Sites node.
    2. Double click .NET Compilation in the ASP.NET section
    3. Under Behavior, set Debug to True.
    4. Click Apply and run the site in Visual Studio.
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Sirius_B
  • 276
  • 1
  • 2
  • 13
3

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
  • 491
  • 3
  • 7
3

I had the same issue on Win7 and VS2010 (without ReSharper) and found that Skype listened on port 80. IIS listens to port 80 by default. This can occur when you set VS to debug an existing web application running in IIS instead of the built in ASP.NET debug web server.

I solved the issue by unchecking "Use ports 80 and 443 as alternatives for incoming connections." in Skype under Tools -> Options -> Connection, followed by a restart of Skype.

Mentoliptus
  • 2,855
  • 3
  • 27
  • 35
  • 2
    On the workstation with the problem, I do not have Skype installed. though this Skype port issue has affected other unrelated issues on other PCs that did have Skype. Thanks for your comment. – GarDavis Aug 02 '11 at 12:59
2

What worked for me was to go into IIS at the server level, click on ISAPI and CGI restrictions, I found that aspnet_isapi.dll for asp.net 4.0 was set to Not Allowed. I set it to allowed and debugging worked. The steps are:

  1. Open IIS.
  2. Click on the top level
  3. Select ISAPI and CGI Restrictions under IIS in the Features view
  4. Examine the Descriptions and if ASP.NET v4[current version] has the Not Allowed Restriction, click on the "Allow" link in the Actions section of the dialog.

This change should take care of the problem. Note that I came up with this solution when I tried to run the web app withoug debugging and I came up with the following error:

HTTP Error 404.2 - Not Found The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

Kberg59
  • 23
  • 6
1

Another thing to try (this is what worked for me):

In IIS, click Application Pools > (Your Site) > Advanced Settings, and change "Enable 32-Bit Applications" to True.

Isaac Lyman
  • 2,175
  • 1
  • 22
  • 42
0

What worked for me was to edit the HOSTS file in the C:\Windows\System32\drivers\etc folder and set the loopback for the website name I'd setup.

For example:
127.0.0.1 http://guyellisrocks.com/

Guy
  • 65,082
  • 97
  • 254
  • 325
0

I've had the same issue and in my case it happened because the AppPool identity was set to impersonate an AD user which had its password changed. Therefore the process could not start and the AppPool always stopped when trying to debug from VS.

After updating the password in the AppPool/Advanced Settings/Identity everything started running smoothly.

Ovi
  • 2,620
  • 7
  • 34
  • 51
0

Check whether the msvsmon.exe (Visual studio Remote Debugging Monitor) file is existing in the below path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x64

If the file does not persist on the above mentioned path,then you need to get it from any other machine which is having the same version of Visualstudio.

Nirmalraj
  • 1
  • 1
0

Having tried all of the solutions above, I was still having this issue. Other projects were debugging without issue, so I knew it had to be something to do with this particular application's configuration.

Mine is an MVC app running under IIS 8. The issue was with URL Rewriting.

I had a rule to enforce trailing slashes. All I had to do was disable it (which can be done in IIS directly, or via the web.config below - just set enabled="false")

 <rewrite>
        <rules>
            <rule name="AddTrailingSlashRule1" enabled="false" stopProcessing="true">
                <match url="(.*[^/])$" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Redirect" url="{R:1}/" />
            </rule>
        </rules>
    </rewrite>
Tommy W
  • 649
  • 6
  • 8
0

Unload project, right click "edit abc.csproj" You will see the configuration. If your project is mapped to use IIS Web Express url.

<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>6270</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://matrimonyfree.in/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>

verify If you have started the web site in IIS http://matrimonyfree.in in this case

sham
  • 691
  • 8
  • 28
0

It may also be because of some special or illegal format in your config file i will suggest you to check for that first .

In my case i was getting an error because of that when i tried to browse my service from IIS it showed me the real error .

Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101
0

I tried every single solution put online to resolve this issue and nothing seems to work consistently.

I eventually solved it in both 2010 and 2012 by tracking it down to the following missing file in the Debug Source Files setting

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\

Solution > Properties > Debug Source Files >

Check to ensure all the files are there then remove this entry and everything worked again.

timkly
  • 793
  • 6
  • 14
0

Did you change your bindings on your IIS website? If so, you need to go to your project properties, select the Web tab, and change the Project Url to match your binding. so where it says http:///yourwebsite change it to http:///yourwebsite

This worked for me.

Mackel
  • 1
0

In my case it was the system.webServer > httpErrors > errorMode in the web.config that caused the problem.

If you have errorMode="Custom" try this:

<httpErrors errorMode="DetailedLocalOnly">

See this answer: https://stackoverflow.com/a/15585629/631277 for variations and other ideas concerning URL rewriting

Community
  • 1
  • 1
Matt Kemp
  • 2,742
  • 2
  • 28
  • 38
0

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
  • 5,017
  • 3
  • 35
  • 42
0

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
  • 1,511
  • 12
  • 13
  • 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 Aug 05 '10 at 13:06
0

I had same issue with Visual Studio 2013. In my case I had removed the "Default Web Site" from IIS. To resolve the issue I created the default website again, set physical path to C:\inetpub\wwwroot and port to 80 (default port). After restarting the Visual Studio it worked perfectly. Hope it helps someone.

Ankit Vijay
  • 3,752
  • 4
  • 30
  • 53
0

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
  • 587
  • 6
  • 5
  • The error happens for WinForms apps, not just ASP.Net. So there is no tie-in to IIS. – GarDavis Aug 25 '10 at 19:09
  • 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 Aug 25 '10 at 19:13
  • 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 Aug 28 '10 at 16:28
0

enter image description here

Unable to start debugging on web server. the web server not configured correctly.

How to resolve this problem?

Step-1

open Command Prompt (Run as administrator)

Step-2

C:\Windows\system32>cd..

C:\Windows>cd Microsoft.NET

C:\Windows\Microsoft.NET>cd Framework

C:\Windows\Microsoft.NET\Framework>cd v4.0.30319

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i

Furkan Ekinci
  • 2,472
  • 3
  • 29
  • 39
0

I was getting this after a new install of Windows 7 that did not include IIS by default. After installing IIS, the default app pool was created to run under .NET 2.0. Though I was able to set the default App Pool to .net 4 from .net 2, I still got this error. I had to reinstall .net 4 in IIS to get it to work properly. That is, run C:\Windows\Microsoft.NET{FrameworkFolder}\v{FrameworkNumber}\aspnet_regiis -i

sydneyos
  • 4,527
  • 6
  • 36
  • 53
-1

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
  • 324
  • 2
  • 12
  • 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 Aug 16 '10 at 20:54
-1

Unable to start debugging on web server. the web server not configured correctly.

  1. How To Resolve This Problem?

    Step-1

    open Command Prompt(Run as administrator)

    Step-2

    C:\Windows\system32>cd..

    C:\Windows>cd Microsoft.NET

    C:\Windows\Microsoft.NET>cd Framework

    C:\Windows\Microsoft.NET\Framework>cd v4.0.30319

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i Microsoft (R) ASP.NET RegIIS version 4.0.30319.0 Administration utility to install and uninstall ASP.NET on the local machine. Copyright (C) Microsoft Corporation. All rights reserved. Start installing ASP.NET (4.0.30319.0). .................. Finished installing ASP.NET (4.0.30319.0).

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>

-2

One of the things to check is to make sure if IIS is up and running. Something as simple as that would resolve this issue sometimes.

J. Steen
  • 15,470
  • 15
  • 56
  • 63
ravi
  • 1