Black Light
Black Light

Reputation: 2404

How to force startup of WCF service

I have an IIS hosted WCF service, and a client Windows application which, upon the first use of the day, takes a while to respond to the first service call. I believe this to be because IIS shuts down services which are not used for a period of time (and the delay is the restart time for the service). I was wondering whether I could alleviate this by making an asynch call when my application starts up (just to, potentially, get the service to start). I therefore, upon application start, created a "fire and forget" background thread which just opens a connection to the service. The intention being that when my application has finished its own startup, and wants to use the WCF service, the thread will (probably) have finished and the service startup delay will not be encountered by the user.

Is this reasonable ? Is opening a channel to the WCF service enough, on its own, to start the service, or do I need to write some dummy method and call that ?

Thanks

Ross

Upvotes: 0

Views: 347

Answers (2)

Filippo Pensalfini
Filippo Pensalfini

Reputation: 1714

Is this reasonable ?

It doesn't sound like a good approach to me. If you have control over how the service is hosted I would advise you to self-host it.

Upvotes: 0

Dominik
Dominik

Reputation: 3372

Check if you really want your app to handle this task and checkout the AppWarm-Up Module for IIS, maybe you can use this without adding code to your serivce.

Upvotes: 1

Related Questions