3

I have a WCF application. I d like to keep this application live all the time.

If there is a certain period of inactivity, does IIS app pool recycles?

How do I keep it alive all the time?

Should i use a Timer?

I do have sensitive data within the application, and it takes time to populate it, that s why i like to keep it live all the time.

2
  • 1
    this may be helpful: blogs.msdn.com/b/carloc/archive/2008/04/22/… but make sure there are no memory leaks anywhere :) Commented Aug 23, 2011 at 19:52
  • 1
    only other option would be self-hosting (for example in a Windows Service) - then this would be totally up to your code...
    – Yahia
    Commented Aug 23, 2011 at 19:58

2 Answers 2

7

By default in IIS, the App Pool will recyle after 20 minutes of inactivity (idle timeout setting).

You can increase this (I belive setting it to 0 is the equivalent of setting it to never timeout).

However, I think you'd be better off to look at the overall situation, rather than simply adjusting the idle timeout on IIS.

How frequently is the service used? A few times an hour, a few times a minute, many times a second?
How many clients are connecting at the same time?
How long does it take to populate the data? Is the length of that initial load really enough to justify increasing the idle timeout? Etc.

Another option to consider if you want the service up all the time is to host it as a Windows Service. I've done that with one of my services where I needed to maitain a pool of objects.

Just some things to consider.

3
  • Or caching the data out-of-proc using whatever mechanism they prefer.
    – vcsjones
    Commented Aug 23, 2011 at 20:06
  • if you have too much combinations, you can possible keep all the possible results in the memory, hence keep the result set in the memory and query it.
    – user30597
    Commented Aug 23, 2011 at 20:25
  • Yes - just turn off the Idle timeout in the Recycling settings for the app pool. Also disable the 29 hour default recycle. This won't prevent all recycling (eg if the pool fails), but it will stop IIS stepping in unless the app breaks.
    – TristanK
    Commented Aug 24, 2011 at 3:03
4

You could always create a self hosting WCF service and avoid IIS altogether

1
  • fyi: Authentication and Authorization code may change when porting from IIS-integrated to self hosted WCF. Commented Sep 1, 2011 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .