简体   繁体   中英

How to execute Page or Code after website is published on IIS or IIS starts

I have an ASP .NET WebSite project (Web Forms) hosted on IIS 7 but I need to execute the application_start (Global.asax) because I load some stuffs there., so I'm looking for a way to execute this code right after I publish the code and/or when IIS restart,

I don't need to debug, I just need to run a process in the application_start to load the cache info in a background process.,

So the first time I open the website be able to run it fast and all cache data will be available, and the application_start runs the first time the website is executed/opened so that's why I need to find an automatic way to execute the application_start right after the IIS is restarted or the website is published., right now I need to manually open the website

What you need is Application Initialization module in IIS.The original article is quite overwhelming ,a

  • install the Application Initialization Module
  • After the feature has been installed and you have configured an ASP.NET web site, set the startMode of the application pool to AlwaysRunning.

( 在IIS中设置startMode

Setting the startMode will start the Application and thus >will trigger your Application_Start in global.asax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM