Before I start I want to point out that this is not a product review. I have found an excellent way to debug ISAPI DLLs and it happens to require a very inexpensive tool. I just wanted to share this information as it has been so useful!
I've been writing some web services recently using Delphi 7 and IIS 5 and it has been a real pain to debug them.
I used to have a reference to a really good article explaining how to set up IIS as a process instead of a service and then use inetinfo.exe as the host app for the DLL, but I could no longer find it. I tried various other articles / tools etc but was not happy with any of them. Most articles didn't work (thank goodness for XP System Restore) and most tools are targetted at web sites so returned text/html instead of text/xml, which confused my web service client.
Yesterday I came across an ISAPI debugger HERE. I have only been using it for 10 minutes so far and I must say it is excellent! I didn't have to alter the registry at all, and the requests still go through IIS. Here is how it works.
- I created a virtual folder called "Debug" with script access.
- I placed ISAPIfwd.dll into that folder, which is a file supplied with the tool.
That's it for the server!
- Open my ISAPI project in my IDE (Delphi in this case).
- Set the host application as ClientISAPI.exe, another file supplied with the tool.
- Set the run parameters of my project to the full path + filename of my ISAPI DLL.
Again, that's it!
Debugging the ISAPI
- I run my ISAPI project, ClientISAPI.exe runs.
- ClientISAPI.exe loads my DLL (which is why the runtime parameter is needed).
- My web service test application then calls the following url http://localhost/debug/isapifwd.dll/wsdl/IMyWebService.
- ISAPIfwd.dll receives the request, passes it to ClientISAPI.exe.
- ClientISAPI.exe then runs the required code in my ISAPI DLL, meaning that I can step through the code.
- ClientISAPI returns the Response to ISAPIfwd.dll, which in turn responds to the clie
What I really like about this approach is:
- No registry modifications required.
- You can remotely debug on the actual deployment IIS server.
- It isn't weighted towards websites only, anything which goes through IIS + ISAPI can be debugged.
- Your ISAPI isn't cached, so no need to keep on starting/stopping IIS.