Zhixian's Tech Blog


ASP.NET application restarts on every request (Part 2)

Filed under: web application development — Tags: , , , — Zhixian @ 11:43:12 am

This blog post is an continuation to my previous blog post on the same topic.

In my previous post, I mentioned that I did not reach a definitive conclusion as to what could have cause the application restarts on every request.
As it turns out while working on a module in my project, I chance across another scenario which may cause the same effect.

Just to provide some background, my project was running on ASP.NET framework 4.0  (running on IIS 7.5 in integrated managed pipeline mode).
Development machine was a Windows 7 (x64).

The scenario that I’m talking about is that I had mixed a x86 DLL into the bin folder of the project.

And wham! The issue of application restarts came back again.

I did not find out whether its that particular x86 DLL in question or will the same thing occur for all x86 DLLs (I’m leaning towards all).
My hypothesis that is that I’m running the application off .NET framework 4 on a x64 machine and mixing x86 DLLs with such a configuration will trigger the application restarts on every request.


  1. Replace the x86 DLL with a x64 version of the DLL
    This is the best solution.
  2. In the Advanced Settings of the AppPool use by the project in IIS, set the Enable 32-bit Applications flag to True.
    This works but will cause your application to have some performance issues (ie. slow down the application; running in 32bit vs 64bit).


ASP.NET application restarts on every request

Filed under: web application development — Tags: , , , — Zhixian @ 09:00:12 am

Lately I have been struggling with a very strange issue in one of my ASP.NET projects.

For some strange reason, the application would perform a recompilation on every request.
Having the recompilation means that the application needs to be restarted.
What this effectively means, is that the application will not be snappy as it should be as it will be going through the application life-cycle.

Interestingly, the shutdown reason provided by System.Web.Hosting.HostingEnvironment.ShutdownReason is BuildManagerChange.
Unfortunately, what MSDN has to say about this is:

The compilation system shut the application domain.
The BuildManagerChange member is introduced in the .NET Framework version 3.5.

What’s worse for me is that this topic of BuildManagerChange appears to be relatively uncharted territory.
Either no one has come across this issue or I’m one of the first developers to come across this issue or I’m using the wrong keywords to find resources regarding this topic.

To cut the long story short, I finally come to the conclusion that this is an infrastructure issue, specifically with IISEXPRESS 8.0 which is a bit of a disappointment because I really like developing using IISEXPRESS.
This conclusion was reached by virtue that the problem disappears when I:

  1. Use IIS (7.5, the default for my WIndows 7 machine)
  2. Use the web development server instead of IISEXPRESS
  3. Use IISEXPRESS 7.5 (inconclusive!)

I could not reach to a happy conclusion with point 3. The reason being that when you install IISEXPRESS 8.0, it will effective replace IISEXPRESS 7.5
So when I say “use IISEXPRESS 7.5”, it implies that I’m using a different machine. Since it’s a different machine, there would be tons of probable variables that may result the application in working. Hence, inconclusive.

But point 1 and 2 are good enough reasons for me to lay the blame at IISEXPRESS 8.0
So if you are encountering application restarts for no apparent reason on IISEXPRESS, try it with IIS 7.5

Create a free website or blog at WordPress.com.