我正在学习IdentityServer4 overview.html,但它的工作似乎有问题。
在创建项目的API部分并相应地进行配置之后:
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "http://localhost:5000",
RequireHttpsMetadata = false,
ApiName = "api1"
});
app.UseMvc();
}我得到以下错误:
'IApplicationBuilder' does not contain a definition for 'UseIdentityServerAuthentication' and no extension method 'UseIdentityServerAuthentication' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)有什么建议吗我在这里错过了什么?
编辑1:我已经注意到,我也不能引用名称空间,即使包已经安装和呈现。
即
using IdentityServer4.AccessTokenValidation;或
using IdentityServer4;发布于 2017-10-24 02:11:36
仅仅为了提供更新/回答,IdentityServer4包的后续版本就可以正常工作。
目前使用的是ID4 2.0软件包。
发布于 2017-03-16 14:09:35
嗯,我刚刚关闭并重新打开Visual 2017,问题就解决了。也许Visual在第一次拉下it yServer4.AccessTokenVal环流包时窒息了,并且重新打开项目导致它再次尝试,这次它成功了。
发布于 2018-02-09 14:50:52
如果您从NetCore1.1迁移到2.0,您需要像身份服务器: API迁移到ASP.NET核心2中所描述的那样迁移代码
在配置函数中
Before:
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "http://localhost:5000",
RequireHttpsMetadata = false,
ApiName = "apiApp"
});
After:
app.UseAuthentication();在ConfigureServices函数中
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme =
JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme =
JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(o =>
{
o.Authority = "http://localhost:5000";
o.Audience = "apiApp";
o.RequireHttpsMetadata = false;
});https://stackoverflow.com/questions/42828845
复制相似问题