Application_Start vs serviceAutoStartProviders

允我心安 提交于 2019-12-22 04:50:14

问题


I am using IIS7.5 to force my web app to load automatically (startMode="AlwaysRunning"), and I now want to preload my cache data. I am a bit confused though because two approaches seem identical:

  1. use Application_Start in global.asax
  2. use serviceAutoStartProviders in IIS config files

They seem rather redundant and doing the same thing. If they are, I guess I would rather use Application_Start than create code dependencies in IIS configuration files. Any advice?


回答1:


The Application_Start in the global.asax is fired when the application receives it's first request (first user or autostart) so it is not used to start the site.

Use serviceAutoStartProviders to start http://www.asp.net/whitepapers/aspnet4#0.2__Toc253429241

The IIS Application Warm-Up Module is easier to use http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization



来源:https://stackoverflow.com/questions/28559553/application-start-vs-serviceautostartproviders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!