17

We're currently deploying code to live pretty reguarly at the moment, but the down side is destroying user session data.

Is there a way of being able to recycle IIS without loosing session data, or is persisiting session state in SQL server or alike the only way?

Graham Clark
  • 12,886
  • 8
  • 50
  • 82
gbro3n
  • 6,729
  • 9
  • 59
  • 100

1 Answers1

18

In-memory session state is stored in the memory of the IIS worker process. When you restart the application pool you are effectively stopping and restarting the worker process, so whatever state is held by the worker process, including all session objects, is lost. So, yes, you need store session data outside the IIS worker process, such as in SQL, in order to not "destroy" users' session data.

Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • 1
    Small note, when you recycle application pool, you start new w3wp process, and it serves new requests. And the old process stays in memory until all old requests are not finished or configurable amount of time is not lapsed (name of the setting is 'shutdown time limit', default value 90 sec). – Roman O Dec 08 '16 at 14:58
  • Authentication cookie lost ? – Kiquenet Mar 15 '19 at 08:08