<location> Tag Causes Local Automatic ASP.NET debugging not to work in Visual Studio


This week I got an interesting issue altogether. One of my customers was unable to debug ASP.NET 3.5 application locally using Visual Studio 2008. The application was created using Web Application Project. When we started the application using "Start Debugging (F5)", page came up fine but debugger was not getting attached to process. In Visual Studio we could still see the "Play" button for starting debugging. We didn't get any errors either in Visual Studio or in Event Logs. At the same time when we try attaching the Visual Studio debugger manually then it worked fine.


We confirmed the current user has all the required permissions and is admin on the machine. We went through all the possibilities as per KB - "INFO: Common Errors When You Debug ASP.NET Applications in Visual Studio .NET" but no luck.


When we checked configuration carefully found that the <compilation debug="true" /> Tag was encapsulated within <location path="." allowOverride="true">, like below code snippet -


<?xml version="1.0"?>
<
configuration>
<
appSettings/>
<
connectionStrings/>
<
location path="." allowOverride="true" >
<
system.web>
<
compilation debug="true">
</
compilation>
<
authentication mode="Windows" />
</
system.web>
</
location>
</
configuration>

We tried removing location tag as that was the only thing suspicious here and it started working!!!


So I did some research and found that this is something consistent across all the Visual Studio Versions Supported (2003, 2005 and 2008) when we use the Web Application Project. Basically placing a <system.web><compilation debug="true" /></system.web> setting inside a <location path="."> tag is correctly interpreted by ASP.NET, but Visual Studio thinks that the web.config isn't set up for debugging.


When we try the same web.config with Web Site in Visual Studio 2005 or 2008 it gives up dialogue -


untitled


So to get around this situation we need to remove the location tag from web.config.


I hope this help!


Comments (6)

  1. Chris says:

    What if removing the location tag is not an option?  I have this exact problem, but I need the location tag present in order for a subdirectory to function correctly:

     <location path="." inheritInChildApplications="false">

    Is there any other work-around to allow debugging on the root site while still allowing the presence of the location tag?

  2. Peter says:

    I have the same issue as Chris– removing the location tag is not an option as that is the only way a subdirectory application will work.  Very frustrating!!

  3. Meet2 says:

    Chris and Peter, Unfortunately there is no work around to this at the moment. But it might get fixed in next version.

  4. I had this issue and I uninstalled my IE 8 – and used IE7 version – Now I am able to debug thru Visual Studio.

    Priya

  5. Greg T says:

    This is incredibly annoying. I can remove the location tag in development as I don't need the subdirectories to work locally, but when pushing to production its a pain.

  6. me says:

    Seriously, this is a huge WTF issue for us. We are constantly having to manage our web.config with regards to deployment as the WDP projects are not sufficient at acheiving our simple goal. We also have a nested site that needs this location tag to function properly and I was happy to find that there was a resolution to making my directories work, until I found out I had to sacrifice debugging. Now it seems I'm SOL. Awesome.

Skip to main content