Classic.ASP通过COM调用.NET组件
我有一个在 IIS 7(集成模式)中运行的经典 ASP 应用程序,它需要调用正确注册为 COM 的 .NET 库。
一切似乎都可以找到,但即使我在其中放置了几个断点,我也无法调试该库。 VS 调试器似乎没有中断就跨过去了。
这是我的 ASP 代码:
Dim sso: Set sso = Server.CreateObject("SecurityPlatform.ClassicASP_SSO")
sso.Initialize()
我可以单步调试这些行,但似乎不可能单步执行 Initialize()。
有什么线索吗?
I have a Classic-ASP application running in IIS 7 (integrated mode) that needs to call a .NET library that was properly registered as COM.
Everything seems to work find, but I cannot debug the library even if i put several breakpoints in it. The VS debugger seems to step over without breaking.
This is my ASP code:
Dim sso: Set sso = Server.CreateObject("SecurityPlatform.ClassicASP_SSO")
sso.Initialize()
I can step debug those lines, but it seems impossible to step into Initialize().
Any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不确定为什么您不能单步执行,但这里有一个技巧:
在托管代码中调用 System.Diagnostics.Debugger.Break 方法。一旦执行到达此行,就会弹出一个对话框,允许您将 VS 附加到它。
I am not sure why can't you step through but here is one trick:
put a call to System.Diagnostics.Debugger.Break method inside your managed code. Once the execution hits this line a dialog will pop up allowing you to attach VS to it.
如果这是企业服务/COM+ 组件,您可能需要手动将调试器附加到运行 COM 组件的进程。默认情况下,“进程外”运行的 COM+ 组件不会附加调试器。
上次我这样做时,我们必须附加的进程是最后创建的 dllhost(通常是最高的进程 ID)。您可以通过 Visual Studio 的调试菜单来完成此操作。
If this is an enterprise services/COM+ compoent you might need to manually attach the debugger to the process where the COM component is running. A COM+ component running "out of process" will not have the debugger attached by default.
Last time I did this the process we had to attach to was the last created dllhost (normally highest process id). You can do this via the debug menu of visual studio.
如果您尝试介入通过 COM+ 调用的托管 .NET 代码,请确保将调试器附加到 dllhost.exe 而不是 w3p.exe(或运行 Web 应用程序的任何进程...具体取决于您的IIS 版本)。
COM+ 代码不在 Web 服务器进程中执行...
If you're trying to step in to Managed .NET code being called via COM+, make sure you're attaching the Debugger to dllhost.exe rather than w3p.exe (or whatever process is running your web app...depending on your version of IIS).
COM+ code is not executed in process with the web server...
如果您正在单步执行这些行,那么您将已经附加到调试脚本的过程。但是,要调试 .NET 组件中的代码,您需要附加到调试“托管代码”的进程。您无法从脚本单步进入托管组件,因为您无法同时调试脚本和托管代码。
当您附加到 w3wp 进程时,请确保“附加到:”框包含“托管代码”。现在您的断点将正常工作,但您将无法单步执行脚本代码。
If you are stepping those lines then you will already be attached to the process for debugging Script. However to debug the code in the .NET component you need to be attached to the process for debugging "Managed Code". You can't step from script into a managed component because you can't debug Script and Managed Code at the same time.
When you attach to the w3wp process make sure the "Attach To:" box contains "Managed Code". Now your break points will work correctly but you won't be able to step the Script code.