Does IIS Express support Debugging Classic ASP?

2019-01-15 08:25发布

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?

4条回答
孤傲高冷的网名
2楼-- · 2019-01-15 09:08

This blog post is very helpful. Here's my summary of it and a clearer explanation of setting breakpoints.

Enable ASP debugging in IIS Express:

First, you need to locate the appropriate applicationhost.config file to update based on your version of Visual Studio.

  • Before Visual Studio 2015: You can enable debugging for all web apps by modifying applicationhost.config located in %USERPROFILE%\Documents\IISExpress\config
  • Visual Studio 2015 and later: There is a different applicationhost.config file for each web app. You will need to modify each one separately. The file is located in {solution directory}\.vs\config (Keep in mind .vs is a hidden folder.)

(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.)

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%\iisexpress\ASP 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.

查看更多
Ridiculous、
3楼-- · 2019-01-15 09:12

Surprisingly, IIS Express DOES support classic ASP, unlike Cassini.

(I hadn't even heard of IIS Express before now - looks like a promising way to get developer's machines running a local copy of the site without the complexity of configuring full-blown IIS).

See this blog from Scott Guthrie.

I have not found a way to set breakpoints, etc in classic ASP. I would be very, very surprised if this was supported in any way other than setting break points within the ASP DLL (which will be near useless).

查看更多
祖国的老花朵
4楼-- · 2019-01-15 09:13

The only way I have found to do this is to follow Scott Guthrie's blog as posted in David Lively's answer. Once you have the site set up to allow F5 or Ctrl + F5 start the app. You will need to have installed IIS 5/6/7 and add the site as either the root, or a virtual directory. So you have both IIS express & IIS full blown pointing to the same physical directory. Now fire up the IIS instance. In my case I just navigate to localhost. this will start w3wp.exe Now in VSS attach to process W3wp.exe.

Other than this. I don't believe there is a true solution to debugging ASP classic in IIS Express.

查看更多
看我几分像从前
5楼-- · 2019-01-15 09:25

see also this question to which I answered.

IIS Express and Classic ASP

It's still a little hit and miss debugging classic asp but it is doable

查看更多
登录 后发表回答