调试在ASP下运行的COM(Visual C++)

调试在ASP下运行的COM(Visual C++):
工作环境:  win2000 , VC6.0 , IIS5.0
1.写一个调用com的 ASP
2.在asp文件中加上<% Response.Expires = 0 %>使得asp不会被
cache.
3.假定把asp放在Default Web Site(如c:/Inetpub/wwwroot/)下,在IIS 中选择Default Web Site
的属性,在Home Directory tab上,Application Protection:右边combox
选择Hign(Isolated)使得com运行在独立的进程中,click unload button让IIS
unload你的com(If unload button is disabled, you need not click it)
4.把com 的action project configuration 设为Win32 Debug,并且Build
5.用IE浏览该asp,例如:http://127.0.0.1/testasp.asp
6.VC的tool->options, 在debug tab, enable Just-in-time debugging(checkbox)
7.打开windows task manager,在Processes tab可以看到多个dllhost.exe.因为你已经
浏览了该asp,其中一个dllhost.exe就是你的com的host. 找到这个host可以用
下面的方法(MSDN有正统方法介绍,但我没有用成功):在你的com中输出当前进程号{char buf[128]; sprintf(buf, "ISAPI running in process %d", GetCurrentProcessId()); OutputDebugString(buf);}以便调试(Attach to Process)。OutputDebugString的输出可以用dbgview.exe看到。
然后多按几次IE的refresh,看看哪个dllhost.exe使用了CPU,就是你要找的。
8.在windows task manager选中这个dllhost.exe,右健选择debug,会有一个
VC6.0程序打开并且attach到这个dllhost.exe进程,在这个VC的Project->Setting->
Debug tab->Category combox, 选择Additional DLLs,在下面的local name list中
加入你的com, 如c:/myproject/testcom/debug/testcom.dll
(VC的debug 可以attach to process,但在win2000下不行,如果能够用vc attach 到
dllhost.exe,也可以直接attach)
9.在这个vc中打开你想设断点 的com的源文件,如c:/myproject/testcom/testcom.cpp
在这个文件中设断点
10.refresh你的IE, 你的断点会生效了!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值