IIS 7 application pool stops every night (503 error)

application-poolsiis-7windows-server-2008

I have an ASP.net MVC application running on Windows Server 2008 with IIS 7. Everything works fine, but every night the application pools stops and I receive an http 503 error, I need to restart the pool every morning.

The server is maintained by someone else and I know it is doing some other work at night which I think is causing this. Moreover, I know that I am receiving connection timeouts to the database at night (SQL Server is running on the same machine).

I would be interested in knowing:

  1. Why this is happening. Is this a feature of IIS that it stops the application pool when the server gets too slow, or when too many errors occur?
  2. Is there some configuration to stop this, or is there a way to make the application pool try to restart on its own?

I would be thankful for any hints.

Best Answer

Yes, there is a error interval built into IIS 7. I only have a Dutch version of IIS here. so I might not translate it fully correctly.

Go to Application Groups -> [Right mouseclick on specified application] -> Advanced Settings.

Go to the category Fast security against errors.

You can see here that it is default enabled with a error interval of 5 minutes for 5 errors. You can disable this option or tweak it. You can also make a batch job that will start your application every morning. This option is more secure for your database, because it will be much harder to take down your site and your database with a DoS attack when the error security is disabled.

You can start the application by using the command line like:

%windir%\system32\inetsrv\appcmd start apppool /apppool.name:[Application Name]