ASP.Net 1.1 shadow copy problem

G

Guest

I use this function to load some assemblies from a directory into ASP.Net
application:

Private Function CaricaLibShadow(ByVal Libreria As String) As [Assembly]

Dim Backup As String

Dim Assbly As [Assembly]

Backup = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories

AppDomain.CurrentDomain.SetShadowCopyPath(System.IO.Path.GetDirectoryName(Libreria))

If Not AppDomain.CurrentDomain.ShadowCopyFiles Then
AppDomain.CurrentDomain.SetShadowCopyFiles()

'Carico libreria

Assbly = [Assembly].LoadFrom(Libreria)

'Ripristino dirs shadowcopy originali

AppDomain.CurrentDomain.ClearShadowCopyPath()

AppDomain.CurrentDomain.SetShadowCopyPath(Backup)

Return Assbly

End Function

This work fine letting me loading any assembly in shadow copy so that I can
copy a new version of it over the old one even when the application is
working. The problem is that after I do the copy any new or old application
using that assembly see the old version until I restart IIS. I'd like to know
if I do something wrong and there's a way to make the new version visible
right away.

Thanks in advance.

ACL
 
S

Scott Allen

ICE:

You could watch the directory with a FileSystemWatcher class and
restart when a new version of the assembly appears.

You might try to add your path to the shadow copy list permanently
instead of swapping it in and out (just separate it from the rest with
a ';').


AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


HTH,
 
G

Guest

Hi :)

First of all thanks a lot for your answer.
Then you propose to:

Scott Allen said:
ICE:

You could watch the directory with a FileSystemWatcher class and
restart when a new version of the assembly appears.

Yes, that's an idea but unfortunately it's not an option in my case. The
point at my conmpany is to update the assemblies and have them up and running
immediately *without* restarting anything. Their concern is mostly towards
provide a quick fix to unavoidable bugs while the user don't even have to
notice, but for the fact that what didn't work orrectly a second before is
working the next time. All has to be flawlessly happening behind the scene.
So restarting is not considered acceptable.

Do you know if that is possible and where I could find some docs or samples?

ACL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top