使用自动启动模式时是否会触发 application_start 事件
我已阅读这篇文章 http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series。 aspx 关于asp.net4.0中的自动启动模式,但仍然不明白application_start事件是否在应用程序预热时触发?文章说,应用程序会自动预加载逻辑,在类中描述,注册为 serviceAutoStartProvider。但是应用程序启动呢?“预加载”意味着 application_start 也会触发,还是仅在第一次请求预加载后才触发?
I have read this article http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx about auto-start mode in asp.net4.0 and still don't understand is application_start event fired on application warm-up or not? Article said that application are automaticaly preloaded with the logic, described in class, registered as serviceAutoStartProvider. But what about application start, is "preloaded" means that application_start also fires, or it fires only after preloading on first request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Application_Start 事件不是由 IIS 自动启动功能触发。它仍然会在第一次请求时被触发。
您可以在“Application_Start”中检查应用程序是否已准备好,如果发现尚未准备好,请运行初始化代码。这样,应用程序就可以与 IIS Express(不支持自动启动)和 IIS 7.5 兼容。
The event Application_Start is not fired by the IIS AutoStart feature. It is still fired upon first request.
You may check that the application is ready in "Application_Start" and run the init code if you find it is not. This way the application is compatible with IIS Express (it does not support AutoStart) and IIS 7.5.