James King
James King

Reputation: 6343

IIS Request Limit Recycling for WCF calls

We have an application pool dedicated to a WCF service that is called infrequently (maybe 15-20 times per day).  The calls can take several minutes, however, and the other day we got burned when IIS recycled the app pool while the call was still processing because the shutdown timeout ran out.

We're considering using request limit recycling, instead, but my question is this:  When the application pool recycles "after x requests", is that after the xth request completes?  Or does it kick off the request, start the overlapped process to handle new requests, then subject the xth request to the same shutdown timeout that currently burns us?

Question in a similar vein:
How to detect if the current application pool is winding up in IIS7.5 and Asp.Net 3.5+

Upvotes: 0

Views: 1028

Answers (2)

Avner
Avner

Reputation: 4556

Check your Shutdown Time Limit setting on the app pool.

Regardless of how you do the recycling, this setting is checked to determine how long a request is allowed to carry on for before being forcibly shut down.

When an app pool is recycled, IIS attempts to drain the running requests from the app pool first, and then a in the meantime a new app pool is already started which accepts new requests. By making the setting high enough to accommodate your long running requests, you will allow IIS to safely drain the old app pool.

Upvotes: 1

Houssam Hamdan
Houssam Hamdan

Reputation: 908

I recommend you do the following.

1- Create a bool Ping() { return true;} method under your WCF service.

2- Create an IIS web application responsible of polling the Ping() method. This is the only way i found to keep my WCF services alive.

3- WCF long running operations must be called also from another background IIS process (web app) that must read from a message queue and call the WCF operation. So you need to log the WCF long running operation call requests in queues. This way, you will have the possibility of retrying the call if the app pool where your WCF services are hosted shuts down.

Upvotes: 0

Related Questions