Why am I unable to Debug my ASP.NET website in Visual Studio?

前端 未结 14 699
孤城傲影
孤城傲影 2020-12-31 02:16

I used to be able to attach to my w3wp process and Debug my web application, but this is not working anymore. I have no idea what changed to break this. I\'m using Visual St

相关标签:
14条回答
  • 2020-12-31 03:04

    When you "Attach to process", the Output window should show you (when showing output from "Debug") all the libraries it's loading, and where it's loading them from - for the dll's in your /bin folder these are usually copied to the \Temporary ASP.NET Files\root\ folder - where are yours being read from? Have you definitely cleared them out from there?

    The only other things I can think of:

    1. You've compiled your code in "Release" mode rather than "Debug" (not the web.config) from the Solution Configuration drop-down.
    2. The symbol files (.pdb) are missing from your /bin folder.

    On the "Build" tab of the project properties, you are in configuration "Active (Debug)", you haven't check "optimize code"?

    If you click "Advanced..." on that tab, what value do you have for "Debug Info"? Is it "full" or "none"?

    Responding to comment

    You will find it harder to debug successfully if your code compiled in "Release" mode, and you'll often get the "source code is different" message when you've not rebuilt the symbols (.pdb files) after changes - but you say you've done a clean/rebuild, so that should cover that.

    Yes, your output window will show all the framework dlls that you're referencing as well as your code - but you should see one file listed in there with the name of each project output - those are the ones to look at.

    You don't have some post build event that moves files into the correct directory for your site do you that's silently failing?

    0 讨论(0)
  • 2020-12-31 03:05

    I also had this problem, solved it by changing the "Attach to" code type to Automatic on the "Attach To Process" dialog. (Previously I had this set to "Silverlight Code" due to debugging a different process... it can be easy to forget to change this back.)

    0 讨论(0)
  • 2020-12-31 03:06

    Did you check your assembly.cs file with this attribute

    [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
    

    After reflecting a optimized code you will probably get this. So you must remove this to be able to debug again.

    0 讨论(0)
  • 2020-12-31 03:09

    I was using the Visual Studio extension VSCommands to attach the debugger (convenient). However, IIS Express was running, and I guessed it might be interfering. Sure enough, when I closed IIS Express, suddenly I was able to debug again.

    Joy ensued.

    0 讨论(0)
  • 2020-12-31 03:16

    Are you running any add ins that could be affecting this? Or any tools that apply post build operations to the source code that the DLLs you start debugging with have been modified post build and it actually is correct that it's not the same source code so debugging won't work?

    Also have tried resetting VS?

    devenv.exe /resetsettings

    Edit: if none of the information has aided you here, while painful it might be worth uninstalling and reinstalling VS and SP1. If you go through this and the issue is the same afterwards that atleast assures that the issue lies in either the web.config or the project settings.

    0 讨论(0)
  • 2020-12-31 03:17

    I have tried all the below options in my Visual Studio 2013 Update 4.

    1. Reset IIS
    2. Clean solution and rebuild
    3. Delete the friles from temporary folder C:\Windows\Microsoft.Net\Framework...\Temporary ASP.NET files
    4. Check whether the compilation tag is debug or not

    But none of them worked, here I am listing down the two things which worked for me.

    1. Disabling the "Just My Code" option Tools ->Options -> Debugging -> General -> Uncheck Enable Just My Code.
    2. Edit the web.config file and save (You can always create a space in any line in web.config, that will do)

    Please be noted that this solution can be Visual Studio version specific, and the both fix worked for me in my Visual Studio 2013 Update 4.

    0 讨论(0)
提交回复
热议问题