Random, unexpected shutdown of an asp.net mvc 2 application hosted on aspnix shared hosting
I have a very simple mvc 2 application hosted on the shared hosting platform at aspnix http://www.aspnix.com.

Some times users lost authentication (I use the standard membership provider) during the navigation of the site and are redirected to the login page.
After some research I begin to suspect that the session is lost due to a restart of the application so I decided to install and configure the health monitoring service in order to track for Application shutdown and restart.

After some requests to the application I start to see the following entry in the health monitoring log:

    Event code: 1002 Event message: Application is shutting down. Reason: Hosting environment is shutting down. Event time: 12/8/2010 8:16:33 AM Event time (UTC): 12/8/2010 3:16:33 PM Event ID: d92fbba0487b4bab97bd7eff4b0083bb Event sequence: 38 Event occurrence: 1 Event detail code: 50002  Application information:     Application domain: /REMOVED FOR PRIVACY!     Trust level: Full     Application Virtual Path: /     Application Path: C:\REMOVED FOR PRIVACY!     Machine name: REMOVED FOR PRIVACY!  Process information:     Process ID: 12516     Process name: w3wp.exe     Account name: REMOVED FOR PRIVACY! 

and then a restart of the application.

Then I contacting the aspnix support and it says that the server is ok, that some other big site run with no issue on the same server and that it is probably a problem of my application.

So I start to investigate in my application but I cannot found any problem.

I also realize that the shutdown appears also when I request static resource like, for example a png image!

After some research I found this interesting post on the Scott Gu blog:
http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

So I intercept the Application_End event in the global.asax as Scott teach and then I send a mail every time my application shutdown... and the content is every time the same:

    _shutDownMessage=HostingEnvironment initiated shutdown
    HostingEnvironment caused shutdown
    
    _shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
      at System.Environment.get_StackTrace()
      at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
      at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
      at System.Web.Hosting.PipelineRuntime.StopProcessing()

I know that the the causes of a restart can be changes of the web.config, changes in the bin or aspx files, overuse of memory etc...
But in this case the application shutdown appear also with the request of a static resource and also the other part of the application are very simple and use only the standard membership provider and some linq to sql query...

I also have subscribed to the Application_Error event for all the unhandled exception with no results.

Any idea? 





Random, unexpected shutdown of an asp.net mvc 2 application hosted on aspnix shared hosting
===

I have a very simple mvc 2 application hosted on the shared hosting platform at aspnix http://www.aspnix.com.

Some times users lost authentication (I use the standard membership provider) during the navigation of the site and are redirected to the login page.
After some research I begin to suspect that the session is lost due to a restart of the application so I decided to install and configure the health monitoring service in order to track for Application shutdown and restart.

After some requests to the application I start to see the following entry in the health monitoring log:

    Event code: 1002 Event message: Application is shutting down. Reason: Hosting environment is shutting down. Event time: 12/8/2010 8:16:33 AM Event time (UTC): 12/8/2010 3:16:33 PM Event ID: d92fbba0487b4bab97bd7eff4b0083bb Event sequence: 38 Event occurrence: 1 Event detail code: 50002  Application information:     Application domain: /REMOVED FOR PRIVACY!     Trust level: Full     Application Virtual Path: /     Application Path: C:\REMOVED FOR PRIVACY!     Machine name: REMOVED FOR PRIVACY!  Process information:     Process ID: 12516     Process name: w3wp.exe     Account name: REMOVED FOR PRIVACY! 

and then a restart of the application.

Then I contacting the aspnix support and it says that the server is ok, that some other big site run with no issue on the same server and that it is probably a problem of my application.

So I start to investigate in my application but I cannot found any problem.

I also realize that the shutdown appears also when I request static resource like, for example a png image!

After some research I found this interesting post on the Scott Gu blog:
http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

So I intercept the Application_End event in the global.asax as Scott teach and then I send a mail every time my application shutdown... and the content is every time the same:

    _shutDownMessage=HostingEnvironment initiated shutdown
    HostingEnvironment caused shutdown
    
    _shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
      at System.Environment.get_StackTrace()
      at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
      at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
      at System.Web.Hosting.PipelineRuntime.StopProcessing()

I know that the the causes of a restart can be changes of the web.config, changes in the bin or aspx files, overuse of memory etc...
But in this case the application shutdown appear also with the request of a static resource and also the other part of the application are very simple and use only the standard membership provider and some linq to sql query...

I also have subscribed to the Application_Error event for all the unhandled exception with no results.

Any idea? 




