Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.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
Configuration ASP.NET 5:配置IdentityServer 3身份验证_Configuration_Asp.net Core_Identityserver3 - Fatal编程技术网

Configuration ASP.NET 5:配置IdentityServer 3身份验证

Configuration ASP.NET 5:配置IdentityServer 3身份验证,configuration,asp.net-core,identityserver3,Configuration,Asp.net Core,Identityserver3,我刚刚开始深入研究新的ASP.NET5,创建了一个带有OAuth登录名的测试单页应用程序。我已经知道我可以使用IdentityServer3来实现这一目的,它看起来相当不错。我发现了一个解释如何设置IdentityServer 3的示例。然而,这篇文章似乎已经过时,或者identity server本身没有使用最新版本的ASP.NET 5(目前是beta7) 问题是,当我尝试在Startup.cs中配置IdentityServer时,VS告诉我IApplicationBuilder没有名为Use

我刚刚开始深入研究新的ASP.NET5,创建了一个带有OAuth登录名的测试单页应用程序。我已经知道我可以使用IdentityServer3来实现这一目的,它看起来相当不错。我发现了一个解释如何设置IdentityServer 3的示例。然而,这篇文章似乎已经过时,或者identity server本身没有使用最新版本的ASP.NET 5(目前是beta7)

问题是,当我尝试在Startup.cs中配置IdentityServer时,VS告诉我IApplicationBuilder没有名为UseIdentityServer的扩展方法时,我收到了一个错误。这似乎是真的,因为在IdentityServer3源代码中,他们有这个扩展方法(而不是IApplicationBuilder)

这是我的代码(Startup.cs):

错误(在最后一行)是

“IApplicationBuilder”不包含“UseIdentityServer”的定义,并且最佳扩展方法重载“UseIdentityServer扩展。UseIdentityServer(IAppBuilder,IdentityServer选项)”需要类型为“IAppBuilder”的接收器

显然,如果我将Configure方法中的参数类型更改为IAppBuiler,它将抛出运行时错误,因为依赖项注入将无法注入该类型。即使会,我也会失去UseMvc()扩展方法

你能给我指一下正确的方向吗? 也许我只是错过了一些微小但关键的东西

提前谢谢

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    // Add MVC to the request pipeline.
    app.UseMvc();

    var options = new IdentityServerOptions
    {
        Factory = new IdentityServerServiceFactory()
    };

    app.UseIdentityServer(options);
}