Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

asp.net mvc 3 - Does IIS Express support Debugging Classic ASP?

I recently installed Visual Studio 2010 SP1 BETA, ASP.NET MVC 3 RC2 and IIS Express.

I successfully got an MVC 3 project running along with classic ASP pages in the project with IIS Express.

I was wondering if there is a way to set up Classic ASP debugging with breakpoints in Visual Studio while using IIS Express?

If so, are there any tutorials / posts on how to do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To enable ASP debugging in IIS Express:

1. Locate the appropriate applicationhost.config file to update based on your version of Visual Studio.

  • Visual Studio 2015 and later: Each web app has its own applicationhost.config file that you need to modify. Each file is located in {solution directory}.vsconfig (Keep in mind .vs is a hidden folder)
  • Before Visual Studio 2015: You can enable debugging for all web apps by modifying applicationhost.config located in %USERPROFILE%DocumentsIISExpressconfig

(If you cannot find applicationhost.config, it is because the web app has not been launched in IISExpress yet. So go ahead and launch your app and then the file will be created.)

2. Open applicationhost.config in a text editor and change the <system.webServer><asp> element to:

<asp scriptErrorSentToBrowser="true" enableParentPaths="true" bufferingOn="true" errorsToNTLog="true" appAllowDebugging="true" appAllowClientDebug="true">
    <cache diskTemplateCacheDirectory="%TEMP%iisexpressASP Compiled Templates" />
    <session allowSessionState="true" />
    <limits />
</asp>

Start debugging:

  1. Start the web site without debugging.
  2. In Visual Studio, open the "Attach to Process" dialog.
  3. Change Attach to to Script.
  4. Select iisexpress.exe and click Attach.

To set breakpoints:

  1. Once you are debugging, browse to the page you want to debug. (Yes, before you set any breakpoints.)
  2. Return to VS, go to Solution Explorer, and you'll see a "Script Documents" node that lists the files cached by IIS Express. Expand this node until you find the .asp page that needs the breakpoints. (The page won't appear in this list until you have browsed to it per the previous step.) enter image description here
  3. Open this file and set breakpoints here (not the original source file).
  4. Refresh or re-navigate to the page in order to hit the breakpoints.

Keep in mind that if you need to make changes to this page, make them in the original source file, not the version with the breakpoints. And when you save those changes the file is removed from the IIS Express cache so you have to repeat these steps to set the breakpoints again.

For more details see Dixin's Blog.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...