Combatch COM (Visual C ) running under ASP:
Working environment: Win2000, VC6.0, IIS5.0
1. Write an ASP called COM
2. Plus <% response.expires = 0% in the ASP file> makes the ASP will not be
Cache.
3. Assume that the ASP is placed under the Default Web Site (such as C: / INETPUB / WWWROOT /), select Default Web Site in IIS
Properties, on Home Directory Tab, Application Protection: Right COMBOX
Select Hign (isolated) Make COM run in a separate process, Click Unload Button lets IIS
Unload Your COM (if Unload Button IS Disabled, You NEED NOT CLICK IT)
4. Set the Action Project Configuration of CoM to Win32 Debug, and Build
5. Use IE to browse this ASP, for example: http: //127.0.0.1/testasp.asp
6.vc Tool-> Options, in Debug Tab, Enable Just-in-Time Debugging (Checkbox)
7. Open Windows Task Manager, you can see multiple DLLHOST.EXE in Processes Tab. Because you already
Browse the ASP, one of the DLLHOST.exe is your COM's host. Find this Host can be used
The following method (MSDN has an orthodox method, but I have no success): Output the current process number {charf [128] in your COM; Sprintf (BUF, "Isapi Running In Process% D", getCurrentProcessID ()) OutputDebugstring (buf);} for debugging (Attach to Process). OutputDebugstring output can be seen in dbgview.exe.
Then use more IE's refresh to see which dllhost.exe uses the CPU, which is what you are looking for.
8. Select this DLLHOST.EXE in Windows Task Manager, and choose Debug, there will be one
VC6.0 program opens and attach to this dllhost.exe process, in this VC's Project-> setting->
Debug Tab-> Category Combox, choose Additional DLLS, in the Local Name List below
Add your COM, such as C: /myProject/testcom/debug/testcom.dll
(VC's Debug can attach to process, but don't work in Win2000, if you can use vc attach to
DLLHOST.EXE, you can also directly attach
9. Open the source file of the COM you want to breakpoint in this VC, such as c: /myproject/testcom/testcom.cpp
Overlocked in this file
10. Brefresh Your IE, your breakpoint will take effect!