I have written a C# WebService. The problem is that after I publish it to IIS it won't automatically start unless any of its methods is called. This is very frustrating because this WebService has to continuously do some background work immediately after it starts (its constructor executes). If IIS is restarted, the WebService will just sit idly until one of its methods is called. Is there a way to overcome this and force the WebService to execute its constructor immediately after it is published or IIS restarted?
If It has to continuously do some background work immediately after it starts why not implement this in a Windows service? I think you can write a WCF service which will be hosted in the Windows service. That way clients can still call your service, the service can do its background work and wont be dependent on IIS as the host window service will run on its own process.
If you need it to run all the time, your design is flawed. Create a windows service instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With