Permalink: www.outsystems.com/goto/optimizing-temp-aspnet-files The .NET Framework compiles Web pages and code files dynamically, when users request a resource for the first time of an ASP.NET application (e.g., an .aspx file from a Web site). After pages and code files are compiled the output is cached, so that subsequent requests to the resources are more efficient. This cached content is called "Temporary ASP .NET Files". You can get info about this issue at: Understanding ASP.NET Dynamic Compilation The content produced by the Agile Platform (.NET stack only) is hosted by the application server IIS as ASP.NET applications. On the event of an eSpace deployment, old binary data may remain at the Temporary ASP .NET folders, if not deleted, can cause considerable disk usage overhead, e.g., development environments with heavy deployment rates. The ASPNETTempFilesCleanup.bat script in attachment, provides the means to erase old Temporary ASP .NET folders that are no longer being used. This task can be performed manually on-demand, or it can be configured as a Windows OS scheduled task. As an example, the command can be used in the following manner, in a command prompt: ASPNETTempFilesCleanup "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" This script is provided as "as is", without any warranty, and you must use it at your own risk. Also, feel free to customize it according to your own requirements. Hope you enjoy it, Cristóvão Honorato
Additionally to the option of cleaning them up frequently, you might want to change the location of your Temporary ASP.NET files. By default, they are created under c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files (e.g. for 32-bit .NET 2.0) but you can change it to whatever location you want - particularly to a different partition.
In order to do so, you can use the tempDirectory parameter in the <compilation> tag in web.config / machine.config. Documentation from Microsoft to this option can be found in:
To make matters simple, you can simply open your global web.config, locate the compilation tag under system.web and append the attribute. E.g.:
Remember not to append the / to the end of the tag, since this tag usually has further options defined / children nodes.
Final recommendations:
Here's an updated version that adds a new parameter so you can tell the script to delete even the newest directory for each app in the cache if it is X days older than today's date. Useful for cleaning up old eSpaces that have been deleted from your environment. It may whack a folder for something that is fairly static like a theme but IIS will just recompile it anyway with a new timestamp.
The site won't allow me to upload a .bat file, so just rename this file as .bat, create a "Logs" directory within the directory you launch it from, and you're off. I set this as a scheduled task to run weekly on my dev and qa servers.
Cheers!