How to correctly handle a .Net windows service which changes frequently -


i've got windows service going be updated ~ fortnightly

i've got useful code in dll, service couple of simple start , stop methods map identical methods in dll.

i use console app develop/debug dll wondering; instead of service referencing dll directly , requiring uninstall/reinstall every time update, there downside using service wrap console application?

which say, instead of...

private myservice imyservice sub start() myservice = new myservice() myservice.startasync() end start 

doing like...

const serviceexecutablepath string = "c:\blah\myservice.exe" private myservice process sub start() myservice = process.start(serviceexecutablepath) end start 

that way, if want publish, need stop service, replace executable (and relevant dlls) , start again.

i haven't quite worked out how graceful shutdown yet. console app listens ctrl c interrupt , calls myservice.shutdown(graceful:=true) (a blocking call). should try emulate same within service or there better way?

you don't need executable this. can dynamically load dll when bring service up.either manually (see link), or use mef load you.

another easy approach use topshelf host service. topshelf, develop , run service console application. when pass argument install console app, installed service. makes easy replace don't need installers.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -