Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a website on windows server 2008 and iis 7 on a VPS. It works fine and has no problems, but after moving it to a shared hosting server with IIS 7.5, the session is lost after 4 or 5 clicks (like 30 secs) and I have to login again and again.

The two sites are same, I copied the site from the VPS exactly as-is to the shared hosting server.

The session timeouts in both web.config files are same.

On the shared hosting server I don't have access to IIS manager to manipulate the settings. All I have is Plesk Control Panel 9.5 and the website's web.config file.

What could be causing this to happen?

share|improve this question

migrated from stackoverflow.com Nov 26 '11 at 14:34

This question came from our site for professional and enthusiast programmers.

2  
Are you running a web garden or web farm? Could the issue be how your managing your sessions? –  Chris Felstead Nov 25 '11 at 17:42
    
No its on shared Hosting,web.config setting is fine and all session state related attributes set to proper value, the website works fine on vps with windows server 2008 x86. –  Mehdi Mousavi Nov 26 '11 at 5:50
    
You say session state is fine, your problem seems to contradict this. Can you please confirm how you are managing your session state. I suspect it's in-proc which means I'm right and you should follow Ragesh's advice. –  Chris Felstead Nov 26 '11 at 6:27
1  
You are using InProc session state. This means the users session is being stored by 1 processor on the server. When the user requests another page it may not be the same processor (or server) that handles the request. As such, a new session is started. You need to follow Ragesh's advice. –  Chris Felstead Nov 26 '11 at 13:32
1  
@Chris Felstead: That's not true. InProc means In-Process, not in-ProcessOr, it's being stored by one Process, not processor. –  TristanK May 27 '12 at 2:25
show 1 more comment

2 Answers

Shared hosts sometimes have unusually frequent application pool recycles. This could result in your sessions getting wiped out if you're using in-process session state. You can work around this by moving your session state out of process. Since it's a shared host, I'm guessing your only option really is to keep your session state in a database.

Check out the MSDN page on Session-State modes for details on how to do this.

share|improve this answer
    
thanks for your answer.I guess your right.it's something about recycling but I don't know why and what cause to it.In asp.net setting section in plesk control panel the max cpu usage set to 25%.can this be a problem to recycling? –  Mehdi Mousavi Nov 26 '11 at 5:38
1  
There are a whole bunch of reasons why this could be happening. Maybe your host has incorrectly configured your application pool. Maybe the host is sharing application pools with other apps and somebody else's app is causing it to recycle. Your best bet is to work with your host's support folks to get to the bottom of this. –  Ragesh Nov 26 '11 at 9:25
    
There're two common techniques of CPU throttling: the built in one which terminates the worker process (i.e. recycles) when the CPU limit specified is reached, and the Job Object based constraint technique used by WSRM. Depending on the host, you might find that this CPU limit causes the process to terminate rather than throttling it. –  TristanK May 27 '12 at 2:26
add comment

Are you using Form Auth? If yes please try this out on your Web.config file:

<system.web>
    <authentication mode="Forms">
          <forms timeout="50"/>
    </authentication>

    <sessionState timeout="60"  />
</system.web>

Good luck!

share|improve this answer
    
thanks for your attention but I have set all of the related code to the sessionstate In webconfig.Its not about it I said that this website works fine on windows server 2008 x86. –  Mehdi Mousavi Nov 26 '11 at 5:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.