Application Debugging is disabled in Visual Studio

2019-02-07 03:19发布

问题:

I'd like to debug Classic ASP website at Visual Studio 2012 with IIS Express. Hence, I attached the iisexpress.exe in VS 2012, but it shows Application Debugging is disabled. What could be a problem ? Do I want to enable any configuration settings?

回答1:

I don't have visual studio 2012 to test it on as far as I know visual studio cannot debug asp classic code natively. The way I debug my asp classic code is to put in stop statements on the line above the one I want to debug like this post says. the break point is just typing in stop.

function DoDate(inp)
   stop
if isnull(inp) then
    DoDate = "Never"
    exit function
end if  

In the above example the page when loaded will stop at the breakpoint and pop up a dialog asking if you would like to debug it, you can then step through the function and even see variables like you normally would.

note: The link says visual studio 2005 but it also works in 2010(and should also work in 2012), you also do not need the DEBUG extension.

also ensure you have server side debugging activated in IIS or this will not work.



回答2:

First of all you need to enable server side debugging of classic ASP script. Do this by running the following commands:

"C:\Program Files (x86)\IIS Express\appcmd.exe" set config "[YOUR_SITE_NAME]" -section:system.webServer/asp /appAllowClientDebug:"True" /appAllowDebugging:"True"  /commit:apphost

Where [YOUR_SITE_NAME] is the name of your website. You can find this name by opening up:

%USERPROFILE%\Documents\IISExpress\config\applicationhost.config 

...and searching for your site.

Next, start an IIS Express instance from the command line:

"C:\Program Files (x86)\IIS Express\iisexpress.exe" /config:c:\users\kevin\Documents\IISExpress\config\applicationhost.config /site:"[YOUR_SITE_NAME]" /apppool:"Clr2IntegratedAppPool"

Again, [YOUR_SITE_NAME] is the name of your IIS Express website.

Then attach Visual Studio 2012's debugger and set a breakpoint in the script you wish to debug. Browse to your site/script and your should see the breakpoint light up:



回答3:

Go to IIS-->ASP-->Debugging properties -->enable client and server side debugging

then attach w3wp process from VS2012



回答4:

I like using Full-blown IIS on my dev machine as it's what my web servers run and have had problems with differences between Casini and IIS in the past..

Anyway, I was unable to do it the way that @Kev suggested. I did some more playing around + reading and found that on the "Attach To Process" window, you need to specifically select "Script Code" in the "Attach To:" option.

1) F9 to set breakpoints in code
2) Ctrl-Alt-P to attach to process
3) Next to "Attach To:" click on the "Select" button
4) Select "Script Code"
5) In my case, attach to "w3wp.exe"

Enjoy debugging your code.