We have Internet Information Server (IIS) 4.0 running Active Server Pages (ASP) with a Visual Basic 6.0 DLL serving data content to the ASP pages. The problem lies when we try to update the DLL on the Web server with a new version, it appears to always be in use and therefore we are unable to upload and re-register a new version. We have shutdown the Web site and also IIS but the DLL is still in use. The only way to clear this is to shutdown the server. As you can imagine, when the site is live, shutting down the box is not really an option. Do you know of a solution to this problem? There is a useful 16-bit utility named WPS which allows DLLs to be closed, however, it doesn’t appear to work with VB6 DLLs.
The reason you are unable to update is because Microsoft Transaction Server (MTS) has the instance of the DLL open. You need to use the utility mtxstop to unload it. First, create a batch file called FlushCache.bat. In the batch file, create these lines:
net stop iisadmin /ymtxstopnet start w3svc
Run the batch file. It will bring down your Web site and bring it back up instantly within about five seconds or so. In between bringing it down and back up, it will also clear the MTS cache. You should then be able to update your DLL.
When you run the batch file for the first time, notice what other services are also stopped (for example, FTP Publishing Service and so forth). Keep a list of them. Then go back to the batch file, and add new lines to start those services back again using:
Update 6/3/00: Bill Bassett suggested this alternative solution:
An easier way to get around the problem of trying to rewrite a DLL is to set up the application so that it runs in its own separate memory space. Using the IIS MMC, right click the virtual directory containing your application. Next, select Properties. In the Application Settings area in the middle of the properties page, then enter a name for the application and check the box to Run in a separate memory space.
Once the application is running, by bringing up the properties page again, the Unload button will be available. When you press the unload button, the application unloads, and you can rewrite the DLL. This won’t de-register the DLL, so you may have to do that and the register of the DLL by hand, using regsvr32. It beats having to stop and restart IIS and other services each time.