Question

I've got one silly question, as I forgot right words to explain:

How to build a web service (ASP.NET) which runs on the server non-stop, much like doing a Windows service? Is it a background worker, or should I use some timer for this ?

Was it helpful?

Solution

Though it doesn't make complete sense to have a web service do automatic continuous stuff w/o being called, do this:

  1. Host the service in WCF.
  2. When the service host is started, start a timer based event and do the work in a Task.
  3. Have appropriate error handling.
  4. This ensures your web service is also available for servicing client requests.

if #4 is not valid, then rethink web service and just have a windows service.

OTHER TIPS

The web service also runs non-stop. The main difference between the two is based upon the manner in which they are accessed. Windows service does not require any user-intervention. The web service runs non-stop, and is invoked through a request via some protocol, mostly tcp/http and other protocols.

Refer this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top