简体   繁体   中英

Why can't I debug my asp.net web project anymore?

Something has changed in my ASP.NET web project... I used to be able to debug. Now my breakpoints are being ignored. I checked my web.config, and it says:

<compilation defaultLanguage="c#" debug="true" targetFramework="4.0">

So that all seems in order. What else might be messing up my debug environment?

EDIT: I should also mention that when I run a console app, breakpoints work fine. It's only when I run the web app that breakpoints just don't happen.

This only happens when I'm debugging using IIS. If I use the VS Dev Server, my breakpoints work!

If you have recently upgraded your solution / project to .Net 4.0, your code type when you select to debug may still be 'Managed (v2.0, v1.1, v1.0)' and not 'Managed (v4.0)' meaning your breakpoints will not be hit.

When you choose "Debug > Attach to Process" in visual studio before selecting your process eg "w3wp.exe", click the 'select' button of the 'Attach to' section and select the 'Managed (v4.0)' option.

Hope this helps.

在此输入图像描述

Try this:

  • Clean and recompile your solution.

or

  • Be sure to close ASP.NET development server, or reset IIS (iisreset /restart).

or

  • Be sure ALL projects are in 'Debug' mode.

or

  • Be sure ALL projects are targeted to the same .NET Framework version.

Even with all the above being done, I left out just ONE other silly little thing. I know this appears above but isn't in the format that a Dot Net Nuke web.config is in. Why this web.config is different from the above, I don't know. I had to set the .net version in IIS and in the Select Process Dialog Box, not here in the web.config.

<!-- set debugmode to false for running application -->
    <***compilation debug="true"*** strict="false">
      <buildProviders>
        <remove extension=".resx" />
        <remove extension=".resources" />
      </buildProviders>
      <assemblies>

I noted not one answer above included checking this. :) Took me a LONG time, knowing it had to be something silly I just forgot, to figure this one out.

Oh well ... doing too much of only SQL Programming for a year and then getting back into ASP.Net heavily does have its challenges ... or should I use that as an excuse, he he.

In Visual Studio, the dropdown of Debug/Release may be set to Release, in which case you may have problems debugging. Both that and the web.config setting should be in debug mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM