Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Our Top 10 Tips for Classic ASP : Page 3

Tidy up your server-side programming techniques with these 10 great tricks for classic ASP.


advertisement
What's the Deal with DLL?

If you've been using Visual Basic COM components, you've probably repeatedly banged your head against the wall trying to deal with the "Unable to write (or copy) DLL, Permission Denied," error message that pops up when you try to update a new version of your COM component. This tip provides a nifty little batch file that you can use to automate the shut down and start up of the MTS process that is holding on to your DLL. This is a standard technique I use all the time in my work.

Question:
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.



Answer:
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 /y mtxstop net 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:

net start <name of service>

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.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date