Easy debugging ISAPI (Environment IIS6.0 Win2k3 VS2003)

xiaoxiao2021-03-06  43

Recently, there is a need to debug an Isapi DLL, check the information on the Internet, such as: How to debug isapi Dlls in IIS 4.0, IIS 5.0, IIS 5.1, And IIS 6.0how to Debug ISAPI DLLS IIS 4.0, IIS 5.0, IIS 5.1, And IIS 6.0) Address in: http://support.microsoft.com/kb/183480/en-us/#3 but still is not right after setting the steps of the article, so he is set according to the idea, the idea is very simple, that is Is the DLL run in the process of IIS? Then debug the process. So first you need to know the process of DLL dependent, the following table shows the process model for the recent IIS version. IIS5.0 platform architecture: Windows 2000 application process Model: TCP / IP kernel DLLHOST.EXE (multiple DLL hosts in medium or high application isolation mode) IIS5.1 platform architecture: Windows XP Professional application process model: TCP / IP kernel DLLHOST.EXE (in medium Multiple DLL hosts in high application isolation mode) IIS6.0 platform architecture: Windows Server 2003 family application process model: http.sys kernel When IIS is running at IIS 5.0 isolation mode: inetinfo.exe (for internal Application) or DLLHOST.EXE (for process external applications) When IIS is running when the work process isolation mode: w3wp.exe (multi-work process) (taken from IIS help documentation, friends who are interested in IIS can continue to study Hey. Just remember to share the results.) Based on the table IIS6.0 can run in two modes, how do you know that the pattern is running now? It is very simple to open IIS Manager to see if there is " The Pool "folder is the working process isolation mode; if there is no" application pool "folder, IIS 5.0 isolation mode. According to my IIS manager, I have "Application Pool" folder, I get my IIS running in the working process isolation mode, and the ISAPI DLL is launched in the W3WP.exe process.

Ok, let's try it now, (Determine IIS has started, log in to the administrator role,) 1: Create a virtual directory 2: Create an extension ISAPI DLL (MFC) project with VS2003 in the virtual directory: Generate the project. Four: In the first line of the default (chttpserverContext * PCTXT) function, set a breakpoint. 5: Click the Trial Menu -> process, click the display system process in the process window to find our w3wp.exe Click to attach. Attached to the pop-up Select Native in the process of the process, select Native click OK, turn off the process window, and the debug environment is created, just wait for you to trigger. Six: Open the IE browser, browse your ISAPI DLL, such as: http: // localhost / Myweb / myisapi / debug / myisapi.dll Enter, is there a breakpoint in the VS2003 code (no need to stop the IIS service). Then start tune. Good luck! Other Environment I have not tried it, but I want to think according to the above ideas.

转载请注明原文地址:https://www.9cbs.com/read-74783.html

New Post(0)