Losing HttpContext with async await in ASP.NET Identity GetRolesAsync
问题 This is more of an async/await question than ASP.NET Identity. I am using Asp.Net Identity, and have a custom UserStore, with a customized GetRolesAsync method. The UserManager is called from a WebApi controller. public class MyWebApiController { private MyUserManager manager = new MyUserManager(new MyUserStore()); [HttpGet] public async Task<bool> MyWebApiMethod(int x) { IList<string> roles = await manager.GetRolesAsync(x); return true; } } public class MyUserManager : UserManager<MyUser,