How to handle former global event handlers in ASP.NET 5?

陌路散爱 提交于 2020-01-04 06:13:33

问题


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.

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.");
}

But, as I know there is no such handlers in the new Startup.cs file. So, my question is - how can we do that?


回答1:


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?



来源:https://stackoverflow.com/questions/32943156/how-to-handle-former-global-event-handlers-in-asp-net-5

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