Application Debugging is disabled in Visual Studio 2012 on Classic ASP Debugging - debugging

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?

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:

Go to IIS-->ASP-->Debugging properties -->enable client and server side debugging
then attach w3wp process from VS2012

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.

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.

Related

Stop site when stopping debugging

I think this might be related to:
Visual studio debugger, dont stop website on stop debugging
And:
How can I prevent Visual Studio 2013 from closing my IIS Express app when I end debugging?
In Visual Studio 2015, it appears that the behavior has changed again, and now when I stop my application in VS 2015, the website continues to run in IIS. That's not necessarily a problem, except when I then try to restart the website I get this error dialog:
And now I can't debug anymore (none of my breakpoints will be hit). Note that it absolutely is not a Release build and it debugged just fine the first time.
So how can I make it either not throw up that dialog and have debugging just work? Or else make it so that it stops the website in IIS when I stop the debugging (note: as far as I can tell "edit and continue" is still on for my project)
Under the "Debug" menu, you have the ability to "Terminate All" and this is what I have been using to make sure that the IIS express instance is closed as well so I don't run into these issues.

Getting error while trying to run a classic ASP website in Visual Studio 2010

I have a classic ASP website deployed over IIS.
I am opening that website from the same location in visual studio 2010 (in order to debug, as per the steps mentioned here
The problem is that, when I hit F5 in visual studio it is giving me an error saying "your server does not support debugging of asp net or atl..."
I am able to browse the site from IIS, but I want to open it in Visual Studio in order to debug it.
What could be the possible reason and solution of this issue?
F5 doesn't do anything good for classic ASP sites (f5 will try to compile a .NET site and then access it).
I will assume that you are trying to debug the site on the same machine where it's running. The way you debug "classic" ASP using Visual Studio.NET is by attaching to the process running the site. The easiest way to do this is to use the Just In Time (JIT) feature: insert a stop statement in the code (debugger in jscript) - hitting that line should initiate a server-side "Error of type "Script Debugging" was encountered. Do you want to debug?" dialog, with suggestions of available debuggers to use.
Try this and report what happens - there might be some extra steps needed to configure that machine.
Are you using IIS 7?
If so you should the server option "Enable server side debugging"... It should be in the properties window of the site, using IIS Management Console.
Once you do that, when you run the server through Visual Studio, it should open another solution on debugging mode with the relevant code.

Visual Studio Script Debugging - Invalid Process 'Type' for inetinfo.exe

I'm having an issue debugging a Classic ASP application from Visual Studio. When I attach to the inetinfo.exe process, I'm getting the message
The breakpoint will not currently be hit. No symbols have been loaded for this document
I think I've isolated the issue as being an incorrect process type being given to inetinfo.exe.
The following screenshot shows what i see when I select 'Debug -> Attach to Process' in Visual Studio 2010:
The inetinfo.exe process "Type" is reported as
T-SQL, Managed (v2.0.50727), x86
Whereas, I would expect it to be:
T-SQL, Script, x86
I have script debugging turned on in IIS, and the application protection level is low. Incidentally, if I flip the application level to medium or high, I see the same on dllhost.exe.
To reiterate, I am trying to debug a Classic ASP Script application, not a managed ASP.NET application.
Is there any reason why (I assume) IIS is getting itself in a pickle?
As it turns out, I should have read my own article on this (Debugging Classic ASP From Visual Studio 2010):
Floundering around, I ran this:
regsvr32.exe "C:\Program Files\Common Files\Microsoft Shared\VS7Debug\pdm.dll"
After an IIS restart I found that this fixed it.
For anyone else toiling with this issue, there is an excellent section in the following article: How to Debug Script Code Using Visual Studio .NET. The section you are looking for is titled "There is no “Script” option for attaching to the script host"

How to keep IIS Express running after finished debugging?

I'm using IIS 7 express to test a ASP.Net MVC 3 project on my development machine and normally it keeps running after I finished debugging, which is a good thing so that I can perform small tests directly in the browser without needing to run the project again.
But if I choose the option "Enable edit and continue" on the project properties IIS 7 will only run while debugging the project. Is there a way to change this behavior?
No, because in order to achieve this, Visual Studio uses a hosting environment that interprets the code being executed.
So, it is only available while debugging.
There is global setting in Visual Studio to have 'Edit and Continue' to be off by default for all new projects under Options > Debugging > Edit and Continue.
Just in case if you need this feature (IIS to continue running) in ASP.NET Web Forms, instead of pressing F5 (Run), right-click the start page in Solution Explorer and select 'View in browser'.

How do I keep the development web server (Cassini) running in Visual Studio 2008?

I'm using Visual Studio 2008 to develop ASP.NET applications. Currently I'm debugging with running on IIS. I would like to switch to the development web server (Cassini) for debugging, so that I can use features like edit and continue. The reason that I'm not, is because the development web server only starts up when you are in debug mode. Is there any way to keep it running all the time, and just have Visual Studio attach to the existing server process like it does with IIS?
Rihan is partially correct...
In your Project Property page, Web tab: Enable Edit and Continue
If checked - The Development server will close when the app (not VS) stops.
If unchecked - Development server keeps running
You can also start your cassini server from the command line which takes alot of pain out of the whole "debug" effort...
Check out a good snippet here on how to do this: https://thoughtjelly.wordpress.com/2009/05/13/launch-cassini-from-the-command-line/
Once started, the built-in web server continues executing even when you stop debugging, as long as your VS2008 project is still open. Just start up the debugger when you want to start debugging again. I typically have another browser window open and interact with the built-in web server from there instead of the browser window that it opens so I can keep working with the application in the same state even after turning off the debugger (which closes the opened browser window).
I'm running VS2008 on Windows XP SP3.
The simplest way I have found to acheive that is by launching the debugger as normal. Then in Visual Studio goto the Debug menu, and select detach all. It detaches from the Cassini web engine, but it does not shut it down, as it does when stopping debugging.
I am quite sure you are know that there is command line swithces that you can you use to launch the cassini engine, but my guess is you are looking for something slightly easier.
Detaching does not close the browser window that visual studio launched, and if you do close that spesific web window then it will stop debugging.
I am running VS 2008 SP1 on Vista 64x SP1 without IIS.
Hope it helps
Rihan Meij
I have 3 web sites, with Single sign on between each site so I need to start all 3 with attach to process. However, there was no process to attach the debugger to, and whenever I started a project with F5 then stop it, the visual studio web server closed.
The Enable Edit and Continue option didn't change anything.
So to start the web server and keep it running so that you can attach the web project to the process, I simply did a "view in Browser" (ctrl+shift+W). This started the server process but not the project nor the debugger. I could then attach to process easily.
In Visual Studio 2015 you do this by going to Tools > Options > Debugging > General and unchecking the "Enable Edit and Continue" option:

Resources