Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Application_Start immediately when application pool restarts in IIS

Tags:

c#

.net

iis

iis-7

We are doing some caching operations in the application_start phase in the application. So all the cache is going away when the application pool restarts. Is it possible to trigger application_start when the application pool restarts or do you have better ideas to solve this problem ?

like image 520
Barış Velioğlu Avatar asked May 16 '12 17:05

Barış Velioğlu


1 Answers

You could use Application Initialization for IIS 7.5, it borrows functionality from IIS8, or if you are using ASP.NET 4.0 + there is application auto start.

For ASP.NET 2.0 i 3.5 there is a IMO somewhat hackish solution, you can log application pool recycle in Event log and then in event log set a task that will be performed on that event, here are the details

like image 178
Antonio Bakula Avatar answered Oct 14 '22 20:10

Antonio Bakula