Friday, August 25, 2006

OpenSource ISAPI Filter Loader for Debugging

A member of our German Delphi community, had a problem with a product named Egg-Loader. What does it do?

Well, basically it is an ISAPI Filter which routes requests from the IIS to your ISAPI Filter. When you have an update of your Filter, you copy it into the directory where the current one is deployed, but with the extension .update instead off .dll. The Egg-Loader will then unload the current version and use the updated instead. I wrote such a tool a long time ago, for myself. Now, I decided to open-source it. It has done a great job in developing our in-house software Content ACE v3 and v4.

How does it work?

When you setup the ISAPI Filter for your IIS, instead of pointing IIS to your ISAPI Filter, you will have to point it to mine. Rename my ISAPI Filter so, that it matches the name of your DLL. So, if your DLL is called SomeISAPIFilter.dll, name mine SomeISAPIFilter.dll, too.

Now rename your ISAPI Filter to SomeISAPIFilter.upd, short for update. ;-) When the IIS sends the next request to my ISAPI Filter, it will look for your update. It will then rename it to SomeISAPIFilter.run and load it into memory and pass all requests along.

When you have another update, copy it as SomeISAPIFilter.upd into the same directory. Within 10 seconds (default, or 500ms debug-mode) my ISAPI Filter will look for the update. Finding one, it will unload the current Filter and rename it to SomeISAPIFilter.bak, rename yours to SomeISAPIFilter.run and load it. Then, your new version will start to handle all requests.

This little tool has helped me a lot during development. I hope you enjoy it. There are some things that can be done to enhance it for debugging, and it is not designed for live services!

Download at Borland CodeCentral: ISAPI Filter Loader for Debugging.

Two of you have downloaded before the latest update *g* The community member just told me more details about his problem. My version had the same problem. This is fixed now *g* How is that for support?

2 Comments:

Anonymous Anonymous said...

You might be interested in my filter debugger host exe for development.

http://www.eggcentric.com/ISAPIFilterDev.htm

4:41 AM  
Blogger Ondrej Kelle said...

Interesting. What I've written for my own use is a plugin that will put a menu item "Run ISAPI" (shortcut Ctrl+Shift+F9) under Delphi's "Run" main menu item. When executed, the plugin will enumerate running processes and see if there is an instance of dllhost.exe (I'm always using IIS medium protection) with the current project's target DLL loaded. If it finds one, it will restart IIS (so it can update the DLL).
Then it will rebuild the current ISAPI DLL project, ping a configurable URL to cause the DLL to be loaded by IIS, find the instance of dllhost.exe where it gets loaded, and attach the debugger to the process. Although it only works in a scenario where you're debugging the DLL on the same computer on which IIS is running, I've found it quite convenient for my ISAPI development. If there is interest I can publish the source code.

7:16 PM  

Post a Comment

<< Home

Google
Search WWW Search delphi-notes.blogspot.com