Link to home
Start Free TrialLog in
Avatar of son_robin
son_robin

asked on

Replace a vb dll

I want to replace my vb dll in the production server. The dll is used in a web application and the production server cannot be rebooted. It has to be running 24x7.

I should not stop the web service also.

Does anyone know how to replace the dll without stopping the www service? Is any tool available for this?

ASKER CERTIFIED SOLUTION
Avatar of gencross
gencross

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chris_matthews
chris_matthews

You could paste the dll over the top that should work!

If a reply says that the dll is in use then there is no way of updating the dll without stopping the web service

I found that a paste over usually works, but depends on whether the code has changed so much that the compatability has been broken if this is true you need to re-register the dll by runnning regsvr32.exe from the command prompt.

Sorry if you already know this but: -

if your dll is called magic.dll and lives in C:\winnt\system32

then to register the dll you have to do the following at the command prompt


regsvr32.exe c:\winnt\system32\magic.dll

IF THE DLL IS BEING USED YOU WILL HAVE TO STOP THE SERVICE THERE IS NO WAY OF FINDING A MAGIC PROGRAM THAT CAN DO WHAT YOU ARE ASKING

hope that helped


Chris
Avatar of son_robin

ASKER

thanks guys,
but i heard that there is some tool developed by microsoft that do this. Can anyone tell me what is the name of that tool and where i can download it from?
See Gencrosses Answer ... Use com+ or MTS
Do they want the upgrade or don't they?  Stopping the service and all applications using the DLL and upgrading the DLL should be a quick process taking the service down for only a couple of minutes.  If it is to fix a problem that they want fixed, then the service is probably not running correctly as it is now so it shouldn't be a big deal.  If it is to provide future enhancements then they should be willing to make that choice as well.  One of the things that you may be able to do if the company has auto switching backup servers (which I think they probably do if they run 24/7) is to take the primary server down which will force the backup to step in and take its role and upgrade the primary.  Then bring the primary back up and it should take charge again.  When all is stable repeat the procedure for the backup server.

Just because somebody asks for something in a certain way doesn't mean it is possible.  Sure you probably could force the upgrade while it is running by writing directly to the hard drive, but then processes already in motion would begin to fail.  So to me the call is in their hands.  How important is the upgrade to them?

amen twalgrave.  Do the upgrade and then start using COM+.
Besides if you promissed you clients a 99.9 % uptime (and you are fools if you promissed more) then you are allowed 9 H downtime per year... at 99 % uptime you are allowed almost 4 days downtime

also anything 98%+ should have a backup server....
If you really want to run 24x7 you may think about to use window cluster
you can replace the dll if it is in use, we do on a regular basis!

If it is in use then rename the one you wish to replace, then copy your new dll on. (and reregister if necessary)

Any application that then calls the dll will load the new version.

regards

Chris Smith
well not too regular!! :)
christopher_smith,
First of all, not all DLL files in use will allow you to rename them.  Secondly, this is a very dangerous proposal because you are assuming the DLL has maintained binary compatibility.  If it hasn't, you're going to bring the system down for much longer than if you'd have done it yourself.

well obviously, otherwise you would be replacing anything that links with the dll. As the original question says he wishes to replace the dll, no mention of anything that links to a dll.

so the assumption would be that binary compatibility has been maintained, otherwise I would suggest removing the server from service and implementing a correct change.

what type of dll's will not let you rename them?


regards

chris
I have just realised I did not read the original question properly!!
sorry - please ignore my comments!

In future I will read more thoroughly!!

please accept my appologies.

regards

chris
Here's one example and there's plenty more where that came from:

Winnt\system32\ADVAPI32.DLL

Granted this is not a VB Written DLL, but there are system hooks in place that prevent you from renaming that DLL.

That being said, let's move to a VB DL: perform this simple test on your own machine.

Create a VB DLL (I called mine delme.dll).  Compile it.  Then open a project and reference that DLL. In the project in form load, put this code:
    Dim oDLL As delmeDLL.clsDLL
    Set oDLL = New delmeDLL.clsDLL

Run the project and try to rename the delme.dll.

   
I certainly can!

You must be doing it through the development environment,

Try doing as you suggested but actually make the exe, then close vb down and then run the application; you should find that you will be able to rename it!

As for system dll's well that is a different matter, but you will also find that you will be able to rename your c dlls as long as you haven't locked them.

chris
I understand the difference between the development environment and run-time and I realize that the questioner was asking about runtime.  However, you asked me for an example of a type of DLL that you could not rename and I showed you an example.  Some processes (like the VB IDE, some Windows processes and services and many more) take control of the DLL and won't let you change them.  We don't know the questioners environment, but we can derive from the question that they've may have already tried to replace the DLL and ran into a problem in doing so.
Twalgrave

hence my appology!!

I was wrong, I missed the 'service' bit which most definitely will lock it!

and you were right to point out my suggestion was dangerous in this case!!!

so once again ignore my comments, and thanks for advising son_robin that my suggestion may not be the correct one.

regards

chris

ps. I wasn't trying to be cocky!!

I'm glad we got that taken care of :)

Well, apparently the tool that I suggested (I just did a quick search and it looked like it may work) did not work, and I really didn't think it would, but hey, they have a utility for everything else out there, why not one for replacing locked dlls :)

However, If there was one I imagine all of the installation software vendors would use it and rebooting to replace in use files after an install would be a thing of the past.

I think everyone is in agreement that the service needs to be shut down.  While it is down create a package in COM+ or MTS (NT 4) for the DLL.  This will allow you to shut down only the DLL in the future to replace it.
How do you shutdown an individual DLL from COM+?

No the package but only one dll from COM+ package
EDDYKT, the package would only include the one dll because you can't shut down an individual component within COM+.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- split points gencross (for future handling), twalgrave (for present handling)
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

twalgrave
Cleanup Volunteer
Yes, I agree with twalgrave.

I think there is no other way than packing my DLL in MTS in future to avoid this situation.
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange

twalgrave points added to:
https://www.experts-exchange.com/questions/20497999/Points-for-twalgrave-re-various.html