2

I am completely lost trying to figure this out. It has been going on for months. Session values just get lost. I check for Session["uid"] on master page to force user to login page.

System : Windows Server 2008 R2 Enterprise

IIS 7.5

.Net Framework 4.5 specified in web config

Application pool .Net Framework V4.0

Application pool Timeout set to standard 1740

Not a Web Farm.

Session In web config:

<sessionState timeout="60"  mode="StateServer"></sessionState>

I changed the mode to StateServer thinking it is App pool random recycling causing it loose session

I check this post:

Losing Session State

I tested it myself. On a page where is loads countries and then cities based on country selection (updatepanel)... randomly it would just route me to login page on country change. And this is no delay in between change. Change, change, change... and then session["uid"] lost.

I read up on how IIS manages sessions:

https://abhijitjana.net/2010/03/14/beginner%E2%80%99s-guide-how-iis-process-asp-net-request/

can't seem to find answer there.

then i started getting errors like application pool max reached. Then i set worker processes to 25, and it says it now a Web Garden.

Then i thought let me read up on Web Garden. According to this post it is a bad thing and should not be used ?

https://serverfault.com/questions/81689/web-gardens-are-they-good-or-bad-or-what

I just did the worker process increase today so i can't say if that will help, but i also dont want to leave that in place if it going to cause me other headaches.

My web site is non MVC, but i added an API controller to it. Not sure if this would be the issue for the session lost or app pool maxing out.

API not my biggest concern as we plan to move it to it's own MVC project. But for now , my concern is the random session being lost. I'm not sure it being lost. My code simply check if (Session["uid"] == null) go to login page.

I come from PHP / Apache history and never had any issues with Sessions. Basic structure the same between c# masterpages and PHP template

I don't have any issues on localhost or dev server enviroment. It's just when on live server that has a couple of other sites on this happens. I don't think the other site will influence my site? THis is what application pooling prevents?

Community
  • 1
  • 1
Shaakir
  • 464
  • 5
  • 13

0 Answers0