Template Persistent Cache Error with Classic ASP under IIS 7

I installed a classic ASP application on my SBS 2008 server (see Moving Liberum Help Desk to SQL 2005 Express). When accessing the application from a browser, the following message is generated in the server’s Application event log:

Log Name:  Application
Source:  Active Server Pages
Event ID:  5
Level:  Error
Description:  Error: The Template Persistent Cache initialization failed for Application Pool ‘My Classic ASP App’ because of the following error: Could not create a Disk Cache Sub-directory for the Application Pool. The data may have additional error codes.

Find the ASP Compiled Templates Folder

There are several articles, including MSKB 332097, that say you have to give NETWORK SERVICE Full Control of the ASP Compiled Templates folder.

But where is that folder? Most articles refer to Windows Server 2003, and it’s moved under Server 2008. This article has a great trick to locate the folder:  type the following at an elevated command prompt:

%windir%\system32\inetsrv\appcmd list config -section:system.webServer/asp

On my machine, that returned the following:

<asp bufferingOn="true">
<session />
<comPlus />
<cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
<limits />

So now we know that ASP Compiled Templates is under C:\inetpub\temp.


Giving NETWORK SERVICE Full Control of that folder did not solve the problem, however.

The reason is that the Application Pool is set to run with a custom Identity so it can access the application’s SQL database. Here is a screen shot of the IIS Application Pool Advance Properties I created:


Once I gave that custom Active Directory user Full Control of ASP Compiled Templates directory, the persistent cache error went away.

Woo-hoo, this is my 100th post in this blog!

3 thoughts on “Template Persistent Cache Error with Classic ASP under IIS 7

  1. Todd R.

    THANK YOU! I can’t believe how hard it was to find an answer to this problem, but I finally found this, which took care of my issue!!

  2. John Bacon

    Although appcmd gave the same output as your example I don’t have that directory anywhere on my machine.
    The Inetpub directory exists but not on %systemDrive%
    What should I change?

  3. Mark Berry Post author

    John, I can think of two things to try:

    – If inetpub\temp\ASP Compiled Templates exists somewhere else, apply the permissions to that folder.

    – Create the folder wherever appcmd says it should be (on the system Drive) and grant it the permissions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.