如何处理前全球的事件处理程序在ASP.NET 5? [英] How to handle former global event handlers in ASP.NET 5?
问题描述
其实,我们使用ASP.NET 4.5(VS 2013),并希望与新Startup.cs文件,它来自OWIN规格更换的Global.asax.cs。
Actually, we use ASP.NET 4.5 (VS 2013) and want to replace Global.asax.cs with new Startup.cs file, which comes from OWIN specification.
我们记录的开始和应用以这种方式使用的Application_Start和Application_End处理程序结束:
We log the start and the end of application using Application_Start and Application_End handlers in this way:
protected void Application_Start(object sender, EventArgs e)
{
_log.Info("The app starts.");
}
protected void Application_End(object sender, EventArgs e)
{
_log.Info("The app ends.");
}
不过,我知道有新Startup.cs文件中没有这样的处理程序。所以,我的问题是 - 我们如何能做到这一点。
But, as I know there is no such handlers in the new Startup.cs file. So, my question is - how can we do that?
推荐答案
在自Startup.cs正在执行,那么应用程序开始你已经知道了。对于 Application_End
事件看看这个答案:<一href=\"http://stackoverflow.com/questions/27444924/is-there-application-end-from-global-asax-in-owin\">Is在Owin从Global.asax中有Application_End?
You already know when the application is starting since Startup.cs is executing then. For the Application_End
event have a look at this answer: Is there Application_End from Global.asax in Owin?
这篇关于如何处理前全球的事件处理程序在ASP.NET 5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!