Skip to content

IIS WebServer#

Hosted applications require you install ASP.NET Core Runtime. The ASP.NET Core Runtime enables you to run existing web/server applications. On Windows, we recommend installing the Hosting Bundle, which includes the .NET Runtime and IIS support.

When publishing a .NET application it can be published as self-contained, which makes Runtime version less relevant and the latest version can be installed for the ASP.NET Core Module.

Temporary ASP.NET Files#

Is it Safe to Remove ASP.NET Temporary Files?#

Yes, it is generally safe to remove ASP.NET Temporary Files in Windows. These files are generated during the compilation process and are used to store compiled assemblies, application data, and cache information. However, they may become outdated or unnecessary over time, and removing them can help free up disk space and maintain a clean development environment.

Location of the Temporary ASP.NET files#

The first step in clearing ASP.NET temporary files is locating the appropriate folder. The location depends on the version of the .NET framework installed on your system and your system’s architecture (32-bit or 64-bit).

For .NET Framework version 4+, your will find the files in the following directories: * 32-bit systems: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files * 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

For .NET Framework version lower than 4, your will find the files in the following directories: * 32-bit systems: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files * 64-bit systems: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files

The Clearing Procedure#

To do the clearing ASP.NET temporary files, you can create a simple batch script that performs the task. Follow these steps:

  1. Create a batch-file (.cmd or .bat) and past these line: change the path to your to meet your requirements
    @echo off
    iisreset /stop;
    echo Deleting ASP.NET Temporary Files...
    rmdir /s /q "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\*"
    echo Temporary Files Deleted Successfully!
    iisreset /start;
    
  2. To run the script, right-click the saved .bat file and select ‘Run as administrator’. You may be prompted to confirm the action or enter your administrator credentials.
  3. The script will delete the contents of the Temporary ASP.NET Files folder. A confirmation message will appear when the process is complete.
  4. If you want to clear temporary files regularly, you can schedule the batch script to run automatically using Windows Task Scheduler.

PowerShell version can make it even simpler to clean-up all temporary files:

iisreset /stop; 
if ([Environment]::Is64BitOperatingSystem)
{
    Remove-Item '\Windows\Microsoft.NET\Framework64\v*.*.*\Temporary ASP.NET Files\*' -Recurse -force; 
}
else
{
    Remove-Item '\Windows\Microsoft.NET\Framework\v*.*.*\Temporary ASP.NET Files\*' -Recurse -force;
}
iisreset /start;

Other Cache directories#

Website Cache This folder is located in each users local settings folder:

%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache

Visual Studio Backup

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\BackupFiles
The Visual Studio backup folder never gets cleaned out automatically, so you should periodically delete all files and folders under this directory.

Project Assemblies

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\[version number e.g. 17.0_e7f7d5e5]]\ProjectAssemblies
Such a folder is created for each project you have worked on.

Assembly Cache

%USERPROFILE%\AppData\Local\assembly\dl3
This folder is normally associated with WPF or Silverlight development so the same might not exist on your machine.