Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net ';Microsoft.Owin.IOwinContext';不包含';GetUserManager';没有扩展方法吗?_Asp.net_Asp.net Mvc 5_Asp.net Identity_Asp.net Identity 2 - Fatal编程技术网

Asp.net ';Microsoft.Owin.IOwinContext';不包含';GetUserManager';没有扩展方法吗?

Asp.net ';Microsoft.Owin.IOwinContext';不包含';GetUserManager';没有扩展方法吗?,asp.net,asp.net-mvc-5,asp.net-identity,asp.net-identity-2,Asp.net,Asp.net Mvc 5,Asp.net Identity,Asp.net Identity 2,以下代码是从Asp.Net Identity 2.0示例复制的 private ApplicationUserManager _userManager; public ApplicationUserManager UserManager { get { return // Error _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserMa

以下代码是从Asp.Net Identity 2.0示例复制的

private ApplicationUserManager _userManager;
public ApplicationUserManager UserManager
{
    get
    {
        return // Error 
          _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
    }
    private set
    {
        _userManager = value;
    }
}
当样品

#region Assembly Microsoft.Owin.Host.SystemWeb.dll, v2.1.0.0 // C:\....\sample\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll #endregion #区域程序集Microsoft.Owin.Host.SystemWeb.dll,v2.1.0.0 //C:\..\sample\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll #端区
但是我已经使用Neget将所有Owin Nuget包更新为最新版本。

扩展方法已移动到其他名称空间,请尝试添加

using Microsoft.AspNet.Identity.Owin;

但是,
GetOwinContext()
的可能重复项在我的代码中运行良好
GetUserManager()
有问题。您是否按照此处“下载此版本”下指定的步骤操作@KevinJunghans是的,我遵循它升级我的项目。我记得开始时出现了一些错误,我确实重试了。您是在控制器中还是在ApiController中?谢谢!因为他没有正确地标记这一点,所以我会说这为我解决了它!:)这也解决了我的问题。谢谢是的,差不多一年后仍然很有用:)我也帮我修好了:)谢谢。你救了我一天。
using Microsoft.AspNet.Identity.Owin;