I have a hybrid ASP.NET/classic ASP application and I'd like to be able to set breakpoints in the ASP code. Is this possible? Running IIS7 on Win7 with VS2010 Ultimate.
问题:
回答1:
In VBScript, the Stop
statement can be used to trigger a breakpoint.
Response.Write "a line"
Stop
Response.Write "a line after the breakpoint
I'm assuming that this is a local IIS7 instance that you want to debug. On my computer, when I try to load a sample page that has a Stop
statement, I get the Visual Studio Just-In-Time Debugger popup. You will need to provide administrative privileges in order to debug the page.
You may also need to enable server-side debugging in the "ASP" applet in IIS Manager, but when I checked just now, server-side debugging was set to False on my machine.
If you don't mind running Visual Studio with admin privileges (or already do), then you can also try the following:
- Use the "File -> Open Web Site..." command to open the site (under the "Local IIS" section).
- From the Solution Explorer, open the files you want to debug and set breakpoints.
- Start the debugger by selecting the "Debug -> Attach to Process..." menu item. Select the "w3wp.exe" process.
- Now when you try to load a page in your browser, Visual Studio will stop at any breakpoints.
Also note that if you make changes to the pages, the changes will be saved to disk. At work, I use VS2005 this way as my main editor for classic ASP, precisely because I can set breakpoints easily.
A third option that I haven't tried yet might be the recently released IIS Express. It's supposed to be designed specifically for developers who don't have full admin privileges, so maybe debugging won't require an elevation prompt. I'll update my answer if I get a chance to try it out in the next few days.
回答2:
response.write("my value....")
response.end
;)
回答3:
I've run into this situation a few times. This summarizes the "typical suspects". If you know of more, then please add an edit or comment.
Ensure web.config has debug="True"
Ensure that you are attaching to the correct w3wp.exe process
Ensure that the App Pool configuration that is associated with this site in IIS has Maximum Worker Processes set to 1 (found in the Process Model section).
Ensure that the ASP configuration for the site in IIS allows Client and Server debugging (found in the Debugging Properties section).
Ensure that machine.config does not have retail="True" in the deployment tag. The default for this attribute is false, which will permit debugging.
-- ss
回答4:
I am not sure anyone faced this issue or not. i have a asp.net and classic ASP mix application on IIS 7.5 with VS2010. I was following all the necessary steps to debug classic ASP, but no luck. Finally found that when we W3wp.exe was automatically getting attached and by default it gets attached with option "Automatically determine the type of code to debug" and I think in that option it was determining only managed code, not script. I changed it to explicitly select the type of code to debug and selected "Script".. and wow it worked.
One more thing it does not allowed me to select managed code and script together.