How To Debug Isapi Dll's on Windows 2000 with IIS 5by CORBIN DUNN
1. In the "Administrative Tools" portion of the "Control Panel", start the Right click on your website and select "Properties" "Internet Services Manager.":. 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 do not 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 the isy "stopped" and "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 will not 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 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 IIS IIS INTO SOMEWHERE OTHER 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". 3. You Should Now Be Able To Select "Run" and have delphi start in debug mode. Put. 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 Shootingif You get an error About: "a required privilege is not help by the client." The you probably haven't Done Step 3, or you are trying to debug in a scripts directory that has not 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, "starting" the service, "start" the service 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. reg :: REGEDIT4
[HKEY_CLASSES_ROOT / AppID / {61738644-F196-11D0-9953-00C04FD919C1}] "LocalService" = - "RunAs" = - [HKEY_CLASSES_ROOT / AppID / {9F0BD3A0-EC01-11D0-A6A0-00A0C922E752}] "LocalService" = - " Runas = -
[Hkey_classes_root / appid / {a9e69610-b80d-11d0-b9b9-00a0c922e750}] "localservice" = - "runas" = "interactive user"
[HKEY_CLASS_ROOT / CLSID / {61738644-F196-11D0-9953-00C04FD919C1}] "LocalService" = -
[Hkey_classes_root / clsid / {9F0BD3A0-EC01-11D0-A6A0-00A0C922E752}] "LocalService" = -
[HKEY_CLASS_ROOT / CLSID / {A9E69610-B80D-11D0-B9B9-00A0C922E750}] "LOCALSERVICE" = -
[HKEY_CLASS_ROOT / CLSID / {61738644-F196-11D0-9953-00C04FD919C1} / localserver32] "=" d: //windows/inetinfo.exe -e w3svc "
[Hkey_classes_root / clsid / {9F0BD3A0-EC01-11D0-A6A0-00A0C922E752} / localserver32] "=" D: //windows/inetinfo.exe -e w3svc "
[Hkey_classes_root / clsid / {a9e69610-b80d-11d0-b9b9-00a0c922e750} / localserver32] "=" d: //windows/inetinfo.exe -e w3svc "
[HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCONTROLSET / SERVICES / IISADMIN] "start" = DWORD: 3
[HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCONTROLSET / SERVICES / MSDTC] "Start" = DWORD: 3
[HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCONTROLSET / SERVICES / W3SVC] "Start" = DWORD: 3