My IIS 6 Web Server has been throwing a bunch of nasty errors recently and I've been trying to figure out what the heck is going on. The problem is that apparently App Pools have been crashing hard fairly frequently. In most cases this isn't a big deal as IIS will immediately spin up another app pool, but several of the applications running have some persistent external objects (COM Servers) that get orphaned when the App Pool just crashed hard like this. I logged on to my machine today to find 55 instances of this server running - Ouch!
These errors started recently and I've started seeing constant error messages popping up on my desktop of crashed IIS worker processes which has been wreaking havoc on the server.
The error that keeps showing up in the Event Log is coming from Active Server Pages:
Error: The Template Persistent Cache initialization failed for Application Pool 'DotNet20' because of the following error: Could not create Cache Sub-directory for the Application Pool...
What's odd about this is that this an AppPool that I use for ASP.NET primarily. But as it turns out I recently changed the identity of the pool from a fixed account down Network Service. Apparently there are a few ASP pages in this site and these pages are crashing the App Pool hard.
As it turns out the problem is that ASP fails to get access to this temporary directory:
%systemroot%\system32\inetsrv\ASP Compiled Templates
and this directory requires that the Application Pool's Identity account (Network Service in this case) has full access permissions. I added full rights for Network Service and peace and quiet has returned to my server environment. Sheesh.
Windows Permissions Please
I never really understood the permission settings on temporary directories in Windows. It seems crazy to me that the Network Service account - which is the default IIS identity account now - is not automatically given rights not only in this folder, but also in the temporary ASP.NET temporary files where the same issue exists. The first thing on most systems that I have to do is dig into
%systemroot%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and add Network Service to with full permissions. This is a step that just should not be necessary, especially for new users who won't have clue as to what's causing it. Even though the ASP.NET error message points at the temporary files folder it's not real obvious that permissions are at fault.