.net handler working sequentially and not parallel.

Last week I was working on a .net handler that have many functionalities, that are being triggered from a JavaScript app we have in the company – I realized that the calls to this handler are made sequentially and not parallel as I wold expect.

My first guess was something to do with the application pool’s settings, or some other configuration issue with my iis server, but that direction led nowhere. So I started to look at the code, looking for a lock of some kind, couldn’t find any .. Bad luck.

Than it it me, the handler, in some of it’s methods fetches the logged in users object from the session (only fetches – doesn’t alter in any way) … Hmm what will happen if i’ll drop that IRequireSessionState from the handler ? … And there we go, the handler has returned behaving as I expected – parallel !

Ok, now that I know what is the cause for this problem I made some digging in the web, and found out that I can use IReadOnlySessionState, which will do exactly what I wanted, read things from the session without locking it!


Posted in ASP.NET

Leave a Comment