2

i have a problem. I am developing ASP.NET app with WCF service. There is a custom session manager, which based on SessionID. I'm keeping session ids in static class, which stored in assembly with WCF service.

Sometimes, WCF service unexpectely restarts (or recreates?) and session manager clears with all ids of opened sessions. It's unacceptable in this project.

I readed about the InstanceContextMode/ConcurrencyMode attributes and a set them to "Single", but it has no effect: WCF service restarts all the same.

How to disable WCF service restarting?

  • It looks like IIS recycles the application pool. You can check [this question](http://stackoverflow.com/questions/302110/what-causes-an-application-pool-in-iis-to-recycle) for more details on this. – Sergey Kolodiy Apr 18 '14 at 07:26
  • How are you hosting the wcf service? IIS? – Davin Tryon Apr 18 '14 at 07:27
  • Do you have any exception logged for you WCF service? You can enable tracing and check it. Link: http://www.codeproject.com/Articles/36031/WCF-Tracing-FAQs – Igor Tkachenko Apr 18 '14 at 08:51
  • I am hosting the WCF service on IIS 7.0. I checked IIS application pool settings and disabled pool restart. Some words about log: i'm checked the WCF logs. If i right underdstand, WCF service creates a new listener without any reasons. – Fred Mikhalkov Apr 19 '14 at 08:00

1 Answers1

1

IIS may recycle application pool hosting your application for many different reasons. It means that the process hosting your application will be restarted and all data saved in static fields or classes will be lost.

In order to fix this I would suggest keeping your data in database or some other persistent storage instead of a memory. If this data is used very frequently you may consider creating in-memory cache on top of this persistent storage.

SuMMeR
  • 99
  • 2