Clean Out Temporary ASP.Net Files on your MOSS servers

This article is all about the C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files folder on your MOSS systems…..


I was alerted by one of my systems this morning that I am running out of diskspace on the systemdrive. After running my favourite tool for this kind of situations, TreeSizeFree.exe, I discovered it was hanging while enumerating a sub-sub-sub…. folder of the Temporary ASP.Net Files folder. Don’t you hate it when a tool you have always relied on hangs like that? Well, I do. Of course copy/paste the path into a cmd window and runing the dir command showed me what was wrong. After endless enumeration of that particular folder I discovered that there were 182000 (that is One hundred and eighty two THOUSAND) files in the folder. No wonder my tool hanged a while. So what’s next? How will I clean this up. Here are the commands I used to cleanup that mess:


1. Stop IIS
     iisreset /STOP


2. cleanup the folder(s).


The problem here is that there are a lot of subfolders in there that need to be cleared as well, so you have two options:


A. using the rd command in combination with a for statement:


for /d %i in (“%systemroot%\Microsoft.Net\Framework64\v2.0.50727\Temporary ASP.NET Files\*”) do RD /q/s %i


B. using robocopy. Just create an empty folder in some place and them run robocopy with /MIR. For example:


md %TEMP%\empty
robocopy %TEMP%\empty “%systemroot%\Microsoft.Net\Framework64\v2.0.50727\Temporary ASP.NET Files” /MIR
rd %TEMP%\empty


(Found this trick on a comment on a blog article of Doug Steward who actually wrote another way to do it)


3. Finally restart IIS


iisreset /START


Some of you might prefer to reboot the system because IIS is down anyway at this time.


So hope this helps you out somehow if you discover a lot of files in there


 

/

One thought on “Clean Out Temporary ASP.Net Files on your MOSS servers

  1. You can delete those files but what would have generated them in the first place ? They will get recreated when the pages are hit no ?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>