asp.net - How to implement a Windows Service to manage Session state? -


I am working on an ASP.NET MVC web application which will be deployed in many load-balanced servers. With this setup, a user may have a request from server A to Service A and the next request will be presented by ServerB or ServerC.

We do not want to store session data in the database, because we are trying to minimize database hits as far as possible. As such, we need to manage the HTTP session and store it on other servers.

My understanding is that it is possible by using the Windows service that will manage it for me, but I am unaware of how I would like to implement it. Did anybody talk to me about some good documents to do this? Or to take any damage or other points in mind? Thank you

You have to dedicate a machine that will host the Windows NT service and which (Well you can use one of the web servers as a state server but IMHO would be a very bad idea):

  Net Start Espast  

And then direct your app to use this server:

  & lt; System.web & gt; & Lt; SessionState mode = "status server" KUKELY = "False" timeout = "20" server = "127.0.0.1" port = "42424" /> & Lt; /system.web>  

You can of course replace 127.0.0.1 with the IP address of the server hosting the NT server.

Note 1: Forgetting those items you intend to store in the special session.

Note 2: This is a good solution in the loaded environment, but if you are looking for a real failover clustering then you should use SQL Server.

You can read more about ASP.NET session status.


Comments