Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to force a DLL to unload with IIS 4.0? YES!

ActiveX and DLL Creation

Is there a way to force a DLL to unload with IIS 4.0? YES!

by  bigfoot  Posted    (Edited  )
Is there a way to force a DLL to unload with IIS 4.0? YES!

You are developing a DLL in VB and testing with ASP.
When you use your dll in ASP, IIS keeps it in memory, and when you try to unload/delete the DLL from the server to
go back to VB DLL code and recompile or replace the old DLL with the new DLL, you get a "Sharing violation", because the dll is being held by IIS.

With IIS3 you could stop and restart the server and then recompile the component, but that does NOT work for IIS4.

Setting the object to Nothing in the VBScript code does not work.

There are 2 ways solve this:
#1
Go to control panel / Services and stop the IIS admin service, but that stops the FTP service also.
Then you can start up the service again (don't forget to start up the FTP service).
No go into MMC and start the web server again.
This only takes a few minutes, but if your web site must be up all the time it is not acceptable.

BUT! There is a second way to do this: In MMC click on the folder your dll/app is in and go to properties for the folder.
In the Application settings part of the screen, click on Create. You are going to create an application. Give the app a name like the name of your folder or something - it does not matter.
Click the check box that says Run in separate memory space(isolated process)

Now when you want to recompile your dll, click the button in the same panel that says Unload, and your dll will be able to be overwritten.
You may have to do a regsvr32 (name) /u and re-register it, but it's better then bouncing the web server all the time.

I've been working on this problem for some time now, and I hope all can benefit from it

-Gary :)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top