开发者

Session_End event behind load balancer

I'm creating web application behind load balancer. To this moment I configured it to store session in database but I'm not sure how should I handle session expiration. The problem is not sessions are not removed from database but Session_End event because I have to call some web service method in it.

Assuming Session_End is called when expires the thing I'm afraid of is situation when session is created on one server but finished开发者_C百科 on another. In this case I'm afraid Session_End on first server will be executed prematurely and I will call web service too early. What would you suggest in this situation?

Edit:

I remember some time ago reading about Sql Agent reacting to session end event and then performing custom code. Can anybody confirm that this solution is possible?


The session end event is not supported unless you are using in-process session state. You could look at ScaleOut Software StateServer. I am considering this for my own environment. It implements a distributed session state and support a session end event.

Edit to add more info:

Their web site explains it better that I can (details page), but here is a quick summary. ScaleOut (or similar gadgets) use a distributed cache to manage session state. This means that a process on each of your servers holds session data. The processes communicate between servers, so that all data is shared among all the servers - whichever server happens to be processing a user request, the same session data is available. If one of your servers fail, all session data is preserved, since it is distributed across all servers. In contrast, asp.net provides in-process session state which works only on a single server, a session state server which holds session data in a separate single server (a single point of failure), or sql server session state, which is quite robust, but hurts performance.


Isn't this exactly why you are storing session information within a database?

This solves the problem of "which server is the session on."

As stated below Session_End is only called for inProc session, which you won't be using.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜