DaveDev
DaveDev

Reputation: 42225

How to reset IIS (or otherwise clear cache) when restarting a web application?

I'm working on an ASP.NET app that keeps a lot of data cached. This data remains cached when I restart the app, so I have to reset IIS if I want to rerun the code that gets the data, otherwise it's just taken from the cache. Is there a way that I can automate this?

Upvotes: 5

Views: 48521

Answers (2)

Richard
Richard

Reputation: 109180

Running iisreset from an elevated (on Vista/Win7/Win2008) command prompt will restart IIS and all hosted applications. This is very quick if you keep the command prompt open: up arrow and enter to repeat last command.

Upvotes: 8

adrianos
adrianos

Reputation: 1561

Where are you storing the data? In the application object?

If so, try calling Application.Clear() in the Application_Start method in global asax

Upvotes: 1

Related Questions