Call Async Method from Session_Start
问题 How can I call an async method from Session_Start in Global.asax ? Global.asax: protected async Task Session_Start(object sender, EventArgs e) { Session.Timeout = 10; // Do some asynch work await repository.SetStatsInfo(System.DateTime.Now); } async method: public async Task SetStatsInfo(DateTime time) { using (ApplicationDBContext db = new ApplicationDBContext()) { // Do stuff (update visitors counter in db) .. await db.SaveChangesAsync(); } } I can run it all synchronously (define void