c# - How to host Windows Service (like) in IIS -


how host windows service in iis , keep service runing running on windows? use feature wcf service?

i've not access windows itself, iis. inside service i'll create thread @ scheduled time process data.

in short, can't.

a more detailed answer there 2 problems:

  1. iis worker processes launched when http request comes in. means can't start service system.
  2. iis worker processes recycled (i.e. restarted) on several conditions. example, worker process restarted if no http request comes in long time. means can't control when service shut down, unless have access application pool recycling configuration. keep in mind recycling logic ensures pending http requests complete, not await background threads complete.

you can come partial solution way:

  1. create wcf service method checks if long-running thread alive , if not, starts it.
  2. create very simple windows service periodically (once in 5 seconds) calls method. deploy service somewhere, e.g. on own machine.

the question remains is: need avoid windows services? find place host service? there use cases when windows service best or way.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -