How to speed up debugging and installing inproc servers in IIS or PWS

By: Chris Eyre

Abstract: How to speed up debugging and installing inproc servers in IIS or PWS

Faster ASP development by Chris Eyre

Code and dll for this article is found in Code Central under ID 15078

Hands up all of you that while developing ActiveX libraries get the error:

[Fatal Error] Could not create output file 'z:XXXXMyActiveXControl.dll'?

Which causes you to either restart the web server or reboot your machine.

What is happening here? Is there a problem with reference counting? Is there a bug in Delphi?

It turns out that inproc server dll's do not get unloaded until the server calls
CoFreeUnusedLibraries. In the documentation (windows SDK help file) it recommends
that this should be called in the idle processing of all applications that
act as COM servers. Unfortunately some common Microsoft servers (IIS, PWS and Excel)
don't call this function.

All is not lost though.
I found that by writing an inproc server that calls CoFreeUnusedLibraries
that the server will now release it's grip on the dll's.

By adding this to an ASP page in IIS you can reduce your debugging time.
The only catch being is that you can't rebuild the helper routine without
restarting the server (I know that an exe based server would not have this
problem - but IIS needs to be reconfigured to accept out of proc servers
and that is too much work).

I have supplied the source code and the dll to code central. Chris Eyre


Server Response from: ETNASC03