How do you debug classic ASP?

吃可爱长大的小学妹 提交于 2020-01-06 07:20:45

问题


I have to debug a classic asp site being served by IIS 7 (windows 2008).

How can I do this? I have only worked with ASP.NET.


回答1:


From an MSDN blog post: http://blogs.msdn.com/mikhailarkhipov/archive/2005/06/24/432308.aspx

Here is how to make ASP debugging work:

  1. Enable ASP debugging on the server. (I also added DEBUG verb to the asp extension, but I am not sure if it is required).
  2. Open classic ASP in VS 2005.
  3. Set breakpoint.
  4. View page in browser or run without debugging.
  5. Debug | Attach to Process
  6. Locate IIS ASP worker process (w3wp.exe on IIS6) which exposes x86 and Script and attach as Script.

From eddiegroves comment below:

Regarding Step #1 in IIS7 - IIS > ASP > Compilation > Debugging Properties > Enable Server-side Debugging




回答2:


I realize this is old, but thought I'd reply to help others since I was looking something else up.

You can use Visual Studio to debug Classic ASP.

If you're running a local copy of IIS, just attach the debugger to the w3wp.exe process and you can set breakpoints, add variables to watch windows, etc.

If you have more than 1 website, it's helpful to run each in a separate application pool, and you'll be able to identify different w3wp.exe process in the Attach Process window.

Just choose "script" as the debugger type. If you're running IISExpress, then the iisexpress.exe process is the correct one to attach to.




回答3:


I've found that a useful setting to enable is found at the server level under ASP > Compilation > Debugging Properties > Send Errors To Browser. Set that to "True".

This may not be appropriate under all circumstances (e.g. for an internet-accessible site).




回答4:


Built in classic ASP debugging is pretty poor. I put together this ASP include class which works with Firebug+FirePHP. It allows you to log values (including strings, multi-dimensional arrays and even objects created with json.asp) to the firebug console and view ASP's built in collection objects which can help (particularly with Ajax where you can't output debug data without breaking the json response.) Ajax script load times and errors are automatically logged for quick viewing.

https://github.com/dmeagor/ClassicASP-FirePHP

Released under MIT open source license




回答5:


I use the following (which I got from somewhere online) to write to a log file. I would prefer a method for writing directly to Console in Firefox or Chrome, but this works pretty well for me.

NOTE: "timestamp" is a custom function of mine. You can probably guess what it does, and probably roll your own. ;-)

function error_log( message )
    dim objFSO, objLog
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objLog = objFSO.OpenTextFile( "ASP_errors.log", 8, true)
    objLog.WriteLine "[" & timestamp & "] VBS Message: " & message
    objLog.close
    set objLog = nothing
    set objFSO = nothing
end function



回答6:


This is the way I figured it out:

Put a stop (write stop) on the place where you want to hit the debug point. Then run the application on browser. When the execution comes to stop it will open up debug popup asking do debug with Visual studio (a VS version must be installed). Then it will ask to attach the process and you can use f10, f11 to go step over and in. You can see the data using add watch.




回答7:


  1. host your site on IIS server.
  2. enable remote debugger on IIS server.(follow this tutorial)
  3. import the source code into visual studio.
  4. install remote debugging tool from here
  5. In the remote debugging tool select tools-> options -> no authentication for all users.
  6. Go to visual studio and attach to process w3wp.exe.
  7. if cant see the process (w3wp.exe). Open the website link in browser and select show for all users now u will be able to see the process and attach.
  8. Dont forget to put a debugger in the application :-)


来源:https://stackoverflow.com/questions/57511414/how-can-i-debug-a-classic-asp-page-in-visual-studio-2019

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!