liamfinnie@yahoo.co.uk (liam) wrote in news:562dd1b2.0311030930.118525e9
@posting.google.com:
> I am trying to write a Windows Service which uses the Updater
> Application block.
Just did the same, a service that updates itself.
> The service works fine until I try and include a Post Processor. When
> I include this the windows service seems to get a handle on the file
> it is downloading and then refuses to ever let go of it.
Are you restarting the service after the download? There is something about
loaded assemblies cannot be unloaded in .NET. A workaround would be to
create a new AppDomain that host the UAB, and restart the AppDomain after
each successful download.
Would be nice if you could post something if you figure out the problem as
we soon will use a Post Processor too.

Signature
Rune Huseby
(Removing '2' from the e-mail adress will greatly increase your chance of
reaching me)
Liam Finnie - 14 Nov 2003 17:50 GMT
Well,
I couldn't get the Post Processor to work using a windows service. Time
was tight so I ended up using a scheduled console app.
My problem was:
Three windows services:
Service A - does some work
Service B - does some work
Service C - is the updater
When Service C identifies that a new version of one of the worker
services is available it downloads it into a download folder. The Post
Processor then stops the relevant service, copies in the new code, and
then restarts the service.
This seems to work fine the first time. However the Updater service
seems to keep a handle on the file that it has originally downloaded and
never lets go. So when another version becomes available it downloads
ok but the version that it copies into the new directory is the first
version! And therefore it also executes the Post Processor from the
first version.
If you found a way around this I would appreciate it if you could
enlighten me. You originally mentioned using a differnet App Domain but
I can't seem to find a way to do that either.
regards,
Rune Huseby - 17 Nov 2003 18:09 GMT
> Well,
[...]
> If you found a way around this I would appreciate it if you could
> enlighten me. You originally mentioned using a differnet App Domain
> but I can't seem to find a way to do that either.
Instead of letting the PostProcessor do the copying, launch an exe from the
PostProcesser that stops all services, including Service C, copies files,
than restarts all services.

Signature
Rune Huseby
(Removing '2' from the e-mail adress will greatly increase your chance
of reaching me)