If a website hosted on IIS is showing an old page, image, or response, clearing the right cache can often fix it. The key is to identify where the stale content is coming from: IIS output caching, an application’s own cache, a browser, a proxy, or a content delivery network. These caches are separate, so restarting IIS is not always necessary—and may not solve the problem if the old content is stored somewhere else.
This guide explains how to clear common IIS caches, when to use each method, and how to avoid disrupting other websites on the server. Start with the narrowest fix that fits your situation, then move to a broader restart only if the issue remains.
What Does “IIS Cache” Mean?
IIS can cache responses to help websites load faster, but “IIS cache” can refer to several different things. Understanding the type of cache helps you choose an effective fix.
- IIS output cache: Stores selected website responses so IIS can serve them again without generating each response from scratch. Depending on the configuration, caching may happen in user mode, kernel mode, or both.
- Application cache: Stores data inside the website or application. For example, an ASP.NET application might cache database results or rendered pages.
- Browser cache: Keeps copies of files such as images, CSS, and JavaScript on a visitor’s device. IIS cannot directly clear a visitor’s browser cache.
- Proxy or CDN cache: A reverse proxy, load balancer, or CDN may keep its own copy of a response. Clearing IIS will not necessarily remove that copy.
- File system cache: Windows may keep recently accessed file data in memory. This is managed by the operating system and is different from IIS output caching.
If only one visitor sees outdated content, test in a private browser window or another browser first. If every visitor sees it, investigate the application, IIS, and any proxy or CDN between the server and the visitor.
Clear IIS Cache by Recycling the Application Pool
Recycling an application pool restarts its worker process. This is a practical first step when an ASP.NET application is showing stale data, or when you want to clear in-memory data held by that application. It affects applications assigned to that pool, so check which sites use it before recycling.
To recycle an application pool in IIS Manager:
- Open Internet Information Services (IIS) Manager.
- In the Connections pane, expand the server and select Application Pools.
- Find the pool used by your website. You can check a site’s pool by selecting the site, opening Basic Settings, and reviewing its application pool.
- Right-click the correct pool and select Recycle.
- Test the website again after the worker process starts.
You can also recycle a pool from an elevated Command Prompt. Replace DefaultAppPool with the name of your application pool:
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:"DefaultAppPool"
Recycling usually causes a brief application restart. Users may experience a short delay on the first request while the application initializes. A recycle clears memory held by the worker process, but it may not remove every cached response held elsewhere, such as a kernel-mode cache, proxy, CDN, or browser.
Clear IIS Output Cache
IIS output caching is controlled by configuration and caching rules. In IIS Manager, the Output Caching feature lets you review the rules for a site or application. It is useful for checking whether IIS is configured to cache particular file types, extensions, or responses.
To review output-caching rules:
- Open IIS Manager and select the relevant site or application.
- Open Output Caching in the Features View.
- Review the configured caching rules and their settings, including whether caching is in user mode or kernel mode.
- If you need to change a rule, make the smallest appropriate change and test the site.
There is not one universal “clear all output cache” button that is appropriate for every IIS installation. If the stale response is being served by the application’s worker process, recycling its pool may clear it. If you need to clear IIS-level caching more broadly, an IIS restart is a more comprehensive option, but it affects more than a single application.
Disabling an output-caching rule prevents caching according to that rule going forward, but do not assume that changing the setting instantly removes every existing copy at every layer. Check the response again after the change, and account for any browser, proxy, or CDN cache as well.
Restart IIS to Clear Cache More Broadly
Restarting IIS can help when a targeted application-pool recycle does not resolve stale content and you need to restart IIS services. This is a server-wide action: active websites may be temporarily unavailable, and application pools may need time to start again. Use it during a maintenance window when possible.
To restart IIS from an elevated Command Prompt, run:
iisreset
To stop and then start IIS manually, you can also use:
iisreset /stop
iisreset /start
Do not use a full IIS reset as the first troubleshooting step on a busy production server. It can interrupt unrelated sites and services. If you manage multiple sites, first identify the affected application pool and try recycling only that pool. After an IIS reset, check that the site responds correctly and that its application pools have started.
Clear ASP.NET or Application-Level Cache
An application may store data or complete page output in its own cache. Restarting its application pool often removes in-memory application data because the worker process is restarted. However, the exact behavior depends on the application. A cache stored in a database, distributed cache, or external service may remain in place after an IIS recycle.
For a custom application, the best fix may be an application-specific cache invalidation feature. For example, the application might provide an administrator page, a command, or an API for clearing cached records. Use that method when available, especially if you need to clear one item without restarting the whole application.
For ASP.NET Core applications, the cache may be in the application process or in an external service, depending on how the application was built. Restarting the application can clear an in-memory cache, but it will not automatically clear a shared distributed cache. If the application uses Redis or another cache provider, follow the application’s instructions rather than clearing the entire service without checking its impact.
Also consider deployment behavior. Updating application files or configuration may trigger an application restart, but it is not a reliable substitute for understanding the cache’s source. Review the application logs and configuration if stale content returns after a restart.
Clear a Browser, Proxy, or CDN Cache
If IIS is returning the current version but a visitor still sees an old page, the cached copy may be outside IIS. Ask the visitor to force-refresh the page or test it in a private browsing window. For static assets, changing the asset’s filename or version—for example, using a new versioned CSS or JavaScript URL—can help browsers fetch the updated file.
If your site uses a CDN or reverse proxy, use that provider’s purge or invalidation controls. A purge can target one URL or a larger set of content, depending on the service. Check the provider’s cache rules and time-to-live settings as well; otherwise, the old response may be cached again.
To investigate, compare the response from the origin server with the response seen by an external visitor. Look at response headers for cache indicators such as Cache-Control, Age, or provider-specific headers. Headers vary by setup, but they can help show whether a browser or intermediary is serving a stored response.
How to Tell Whether the IIS Cache Was Cleared
After taking action, test the exact URL and content that appeared stale. Use a private browser window, a different device, or a command-line request so your own browser cache does not confuse the result. If you can, compare the response before and after the change and check the relevant application or IIS logs.
If the old content remains, work through the likely layers in order:
- Confirm that the updated file or data is actually present on the server.
- Check that you changed the correct website, application, and application pool.
- Recycle the relevant pool if the application may be holding in-memory data.
- Review IIS output-caching rules and the application’s own cache settings.
- Check browser cache headers, proxy behavior, and CDN configuration.
- Use a full IIS restart only if a broader service restart is justified.
Be careful when clearing shared caches. A cache may serve several sites or applications, and removing everything can increase server load as content is regenerated. A full cache purge or IIS reset is usually best reserved for situations where a targeted fix has failed or a planned deployment requires it.
Conclusion
To clear IIS cache, first identify which cache is serving the outdated content. Recycling the correct application pool is often the least disruptive way to clear in-memory application data. Review IIS Output Caching when IIS may be storing responses, and use iisreset only when a broader IIS restart is necessary. If the stale content appears only for certain visitors, check browser, proxy, or CDN caching too. Choosing the right layer avoids unnecessary downtime and helps ensure the updated content reaches users.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.