Plugging code to a service

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am writing a vb.net windows service which is expected to have its
processing code changed more often than usual. As uninstalling and
reinstalling a service is bit awkward, is there a way for the service to
call code that residues outside the service that can be changed easily
without having to uninstall and reinstall service whenever the processing
requirements change? If so how?

Thanks

Regards
 
John said:
I am writing a vb.net windows service which is expected to have its
processing code changed more often than usual. As uninstalling and
reinstalling a service is bit awkward,

Yes, but why bother?

So long as you [can] /stop/ the service first, you scan simply overwrite
the executable and then restart it.
is there a way for the service to
call code that residues outside the service that can be changed easily
without having to uninstall and reinstall service whenever the processing
requirements change? If so how?

You're thinking along the lines of "plug-ins" here.
Yes, it's perfectly possible but your problem will be overwriting the
"plug-in" dll's after the service has [loaded and] used it.
You'll have to play with creating AppDomains within the service /into
which/ you load and run each "plug-in" then, when you tear down the
AppDomain, then (in theory) the dll should be freed up for you to
overwrite it.

HTH,
Phill W.
 
processing code changed more often than usual. As uninstalling and
reinstalling a service is bit awkward, is there a way for the service
to call code that residues outside the service that can be changed
easily without having to uninstall and reinstall service whenever the
processing requirements change? If so how?

Yes you can create a plugin framework.

You can use reflection to do this.
 
John said:
Hi

I am writing a vb.net windows service which is expected to have its
processing code changed more often than usual. As uninstalling and
reinstalling a service is bit awkward, is there a way for the service
to call code that residues outside the service that can be changed
easily without having to uninstall and reinstall service whenever the
processing requirements change? If so how?

As Phil said, once you have installed the service, you just stop it using the
Services panel, replace the exe, and start it again. Its very quick.
 
Back
Top