Debug Isapi

转载 2004年10月25日 16:58:00

How to debug ISAPI DLL's on Windows 2000 with IIS 5
by Corbin Dunn

1. In the "Administrative Tools" portion of the "Control Panel", start the "Internet Services Manager." Right click on your website and select "Properties":

2. On the "Home Directory" tab, set "Application Protection" to "Low (IIS Process)":

This causes IIS load ISAPI DLL's inside of its process, allowing you to debug them. Close this dialog, but not the IIS Manager program.

3. Expand your website and right click on the "Scripts" virtual directory (or, whatever directory your ISAPI DLL's will be put into). Again, set the "Application Protection" to "Low (IIS Process)" for the virtual directory (similar to step 2). Important - if you don't do this you will probably not be able to load your ISAPI DLL. You can now close the IIS Manager.

4. In the "Administrative Tools" portion of the "Control Panel" select click on the "Services" and for each of the following services, make sure that they are "Stopped" and that the "Startup Type" is set to Manual:

  • Simple Mail Transport Protocol (SMTP)
  • World Wide Web Publishing Service
  • FTP Publishing Service
  • IIS Admin Service

Close the Services Window.
If after you reboot the IIS Admin Service has started, then try making the Startup Type be Disabled - then reboot and make sure that it has not started. If it has, you won't be able to debug.

5. Run "Local Security Policy" from the "Administrative Tools" folder. Expand "Local Policies", and then click on "User Rights Assignment". In the right hand panel, you should see "Act as part of the operating system". Double click on it, and select "Add..." to add a user to the list. Add your current user to the list that you intend to debug with (for example, I added the user cdunn, which is my main login to my Windows 2000 machine). Close this window after adding the user.

6. Reboot to make the previous step take effect.

7. Merge the file IISProcess.reg to merge the proper registry settings that make IIS run as a process on your system (so you can debug). Important: If you installed IIS into somewhere other than the default directory, you will have to modify this file. The default location is: C:/WinNT/system32/inetsrv". Use IISService.reg to set the registry settings back as a service.

NOTE: These files are on code central as a zip file, but, if you download them individually, you will have to rename the downloaded file to the right name. It may prompt you to name it "getfile.reg", but rename this to "IISService.reg" or "IISProcess.reg".

In Delphi:

1. In your ISAPI DLL project, go to the "Project Options" and on the "Directories/Conditionals" tab, set the "Output directory" to be "C:/Inetpub/Scripts" or whatever directory you put your ISAPI dll's in. Also, make sure you have all debugging information turned on.

2. Select Run->Parameters from the IDE menu. Set the Host Application to be: "c:/winnt/system32/inetsrv/inetinfo.exe" (without the quotes - assuming this is where you installed IIS). Set the Parameters to be "-e w3svc" (without the quotes).

3. You should now be able to select "Run" and have Delphi start in debug mode. Put a breakpoint somewhere in your source code. Now, using a web browser, browse to your ISAPI DLL (such as http://localhost/scripts/project1.dll), and it should stop on the breakpoint.

4. Use Ctrl-F2 to stop the web server and end a debugging session.

Trouble shooting

If you get an error about: "A required privilege is not held by the client." then you probably haven't done step 3, or you are trying to debug in a scripts directory that hasn't had step 3 done on it. Or, you have not rebooted at some point.

If the debugger starts and stops right away, then you probably have inetinfo.exe running. Run the Task Manager and look for inetinfo.exe running. Try to kill it. If you can't it is currently running as a service. Try shutting it down in the services. If it is stuck on "Starting" the service, then run IISService.reg and reboot. After rebooting, stop the service. Then run IISProcess.reg and try debugging.

When releasing your ISAPI DLL application, be sure to undo what you did in these steps to not hinder performance on your DLL.




"RunAs"="Interactive User"






""="d://windows//system32//inetsrv//inetinfo.exe -e w3svc"

""="d://windows//system32//inetsrv//inetinfo.exe -e w3svc"

""="d://windows//system32//inetsrv//inetinfo.exe -e w3svc"







  • lk_cool
  • lk_cool
  • 2006年06月30日 11:41
  • 1491

isapi debug

  HOWTO: Debug ISAPI DLLs Under IIS 4.0 and IIS 5.0 (Q183480)The information in this article appli...
  • duankuanjun
  • duankuanjun
  • 2001年12月04日 09:35
  • 510

Web Service和ISAPI的区别与联系

1、Web Service 是一种新的web应用程序分支,他们是自包含、自描述、模块化的应用,可以发布、定位、通过web调用。Web Service可以执行从简单的请求到复杂商务处理的任何功能。一旦部...
  • zhongguoren666
  • zhongguoren666
  • 2011年11月11日 10:19
  • 2586


ISAPI精彩编程西北师范大学数信学院计算机系 符文科 关键词:ISAPI,数据库,Internet 开发工具:Visual C++ 6.0 以...
  • kiss0kill
  • kiss0kill
  • 2006年11月02日 10:11
  • 1440


ISAPI包括扩展和过滤器两种形式,都可以利用来开发动态动态Web内容。ISAPI扩展和过滤器都以DLL形式实现,供IIS进程调用。   扩展按规范必须实现两个函数接口:GetExtension...
  • ysq5202121
  • ysq5202121
  • 2013年03月26日 10:56
  • 1028


介绍   在Internet时代的开端,客户端的需求非常有限;.htm文件就可以满足他们的需求。但是,随着时间的流逝,客户端需求的扩充超越了.htm文件或静态文件所包含的功能。   开发者需要扩充或扩...
  • taito
  • taito
  • 2005年12月01日 00:53
  • 3273


 用ISAPI看ASP的实现一.        前言 IASPI是IIS的的扩展接口,可以用它来实现动态网页。ASP就是使用ISAPI实现起来的一个扩展程序。本文是在了解了ISAPI技术后,来思考AS...
  • misterliwei
  • misterliwei
  • 2006年11月09日 10:27
  • 4763


什么是ISAPI扩展? 翻译:misterliwei原文:What an ISAPI extension is?(
  • misterliwei
  • misterliwei
  • 2006年10月29日 20:42
  • 8863


C#开发ISAPI程序(摘) 我的注释:不知道这么做出来的dll文件,能否应用在非.Net项目中  主要的步骤1)编写DLL,处理特定的HTTP请求2)在web项目里引用刚编写的DLL,并在web.c...
  • tgh1981
  • tgh1981
  • 2009年06月18日 16:47
  • 3902

ISAPI 与CGI 的 比 较 及 其 实 现

  ISAPI 与CGI 的 比 较 及 其 实 现 龚 建 勇 ( 华 中 理 工 大 学 图 像 识 别 与 人 工 智 能 所) ( 通 信 地 址: 华 中 理 工 大 学 西 五 舍203 ...
  • tlovexyj
  • tlovexyj
  • 2001年04月18日 09:27
  • 1217
您举报文章:Debug Isapi