views:

79

answers:

2

Hi,

My company has a CRM site hosted externally on a shared server and recently it has been very problematic. Users are being logged out randomly, sometimes only seconds after logging in. We are also getting viewstate validation errors at times. Both problems seem to occur more often when there are two or more people logged in at the same time, but I can't really see any particular pattern.

I am using log4net to track the application state and from what I can tell it seems that the application is frequently restarting, causing all sorts of issues. I can see log messages from the Application_Start event handler but there is not always a corresponding message from the Application_End event handler. There is also logging code in the Application_Error event handler but it is not catching anything at the time of the restart.

These errors started to occur soon after we moved our site to this shared server, although I don't remember it being this bad at first.

Any advice on how to track down these problems would be appreciated. The server is running Windows Server 2003 and IIS 6.0. Sadly I don't have access to the server other than through Parallels Plesk and it doesn't seem to have any useful diagnostic information.

A: 

Some hosters consequently restart your sites W3WP process if it consumes too much memory. Sometimes it doesn't need to consume more than 100 megs for them to kill the process.

You should start investigating that.

MartinHN
Hi, is there any way to tell if this is what is happening? I doubt that they would admit to something like this so if it is the case then I need some sort of proof.
James
It could be a known policy that they have. I think they'd tell you if you ask them. If your Application_Start event is fired a lot without Application_Error being fired - my guess would be that your hosting provider is restarting your website due to memory usage.
MartinHN
It turns out that the hosting company has a system in place that rather rudely restarts applications every half hour. This partly explains what's going on and in hindsight the logs do show a pattern.Unfortunately the restarts sometimes become much more frequent which must be down to something else. I have a feeling it could be down to us referencing assemblies that are not on the server.Marked as accepted since this has been the most helpful answer.
James
Not cool. I think you should find another hosting provider.
MartinHN
A: 

It sounds like you are using Application variables. You need to use Lock() and then Unlock() when changing the values of these variables. I have gotten all sorts of strange behaviour when two users have tried to concurrently change application variable values, and I guess this could cause an app pool to restart.

See this link for more information: http://msdn.microsoft.com/en-us/library/94xkskdf(VS.80).aspx

James Westgate
The site does use a few application variables but I'm fairly confident that it is thread-safe. Also, that part has not changed in years and we did not have these problems until recently.
James