views:

38

answers:

2

I'd like to host a WCF web service in IIS. The service should keep a certain set of data all the time, it must never be lost.

My colleague told me this is impossible because IIS closes down the service after a certain time (I assume without any activity). Is that true? How do I prevent that behavior?

In case it matters, both IIS 6 and 7 are available.

+1  A: 

By default, IIS recycles the worker process after a certain period of inactivity (20 mins if I recall correct). This causes your data to be lost.

You can turn off this behavior in the Properties page of the ApplicationPool under which your app is running.

EDIT: having said that, if it is really important that this data is never lost, I would consider storing it in a database or some other form of storage.

Eric Eijkelenboom
A: 

My colleague told me this is impossible because IIS closes down the service after a certain time (I assume without any activity). Is that true? How do I prevent that behavior?

This is true, but you can get around it by using an out of process state server. Here are three links describing session state and how to set it up in IIS:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0d9dc063-dc1a-46be-8e84-f05dbb402221.mspx?mfr=true

http://www.eggheadcafe.com/articles/20021016.asp

http://msdn.microsoft.com/en-us/library/ms178586.aspx

Kevin