2014-11-03 16 views
7

Mam następujący błąd: "System.Web.HttpContext" nie zawiera definicji "GetOwinContext" za każdym razem, gdy debuguję mój projekt. ten błąd występuje na stronie interfejsu API sieci Web, chociaż nie pokazuje błędu w domyślnym AccounController.cs i jest zainstalowany pakiet nuget. czego brakuje?"System.Web.HttpContext" nie zawiera definicji "GetOwinContext"

using IdentitySample.Models; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Net.Http; 
using System.Web.Http; 
using Microsoft.AspNet.Identity; 
using Microsoft.AspNet.Identity.Owin; 
using Microsoft.Owin.Security; 
using System.Web; 
using System.Threading.Tasks; 
using task.Models; 
using System.Globalization; 
public ApplicationUserManager UserManager 
    { 
     get 
     { 
      return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); 

     } 
     private set 
     { 
      _userManager = value; 
     } 
    } 

Odpowiedz

7

ok znalazłem rozwiązanie, ponieważ ja już zainstalowany pakiet Nuget wszystko, co mam do zrobienia jest następujący:

return _userManager ?? HttpContext.**current**.GetOwinContext().GetUserManager<ApplicationUserManager>(); 
+0

który pakiet Nuget pan zainstalować? –

+2

'Microsoft.Owin.Host.SystemWeb'A – Guy

+0

Brakowało mi bieżącej nieruchomości, co ciekawe, przykłady, które znalazłem na OWIN wszystkie miały problemy takie jak ten – Niklas

Powiązane problemy