2016-05-24 62 views
1

我一直在努力實現的OAuth,但由於某些原因,我不斷收到以下異常:GetUserManager返回null

值不能爲空\ r \ n參數名:上下文

而問題是與Request.GetOwinContext().GetUserManager<ApplicationUserManager>();

我創建了一個新的項目,包括身份驗證,並不斷收到此錯誤。還試圖創建一個空的解決方案,但還是同樣的問題..

我有以下的東西在我的啓動

app.CreatePerOwinContext(ApplicationDbContext.Create); 
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); 

任何想法?

回答

2

它的工作原理,當我加入這一行:

app.UseCookieAuthentication(new CookieAuthenticationOptions());