简体   繁体   English

无法将IdentityServer4 NuGet程序包正确添加到ASP.NET Core项目,并且VS代码未显示智能提示

[英]Can't add IdentityServer4 NuGet package to ASP.NET Core project properly and VS Code is not showing intellisense

I've added IdentityServer4 NuGet package to ASP.NET core project using dotnet cli. 我已经使用dotnet cli将IdentityServer4 NuGet包添加到ASP.NET核心项目中。 Then written the following code on Startup class. 然后在Startup类上编写以下代码。

public void ConfigureServices(IServiceCollection services)
    {           
        services.AddIdentityServer()
            .AddInMemoryClients(new Client[] 
                { 
                    new Client
                    { 
                        ClientId = "react client", 
                        ClientName = "React Client",
                        AllowedGrantTypes = GrantTypes.Implicit,
                        RedirectUrls = {"http://localhost:51009/"},
                        AllowedScopes = { "openid"}
                    }
                });            
        services.AddMvc();
    }

Then when I build the project it shows error: The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?) 然后,当我构建项目时,它显示错误: The type or namespace name 'Client' could not be found (are you missing a using directive or an assembly reference?)

Moreover VS Code doesn't show any suggestion for IdentityServer related code. 此外,VS Code对与IdentityServer相关的代码没有任何建议。

And when I search IdentityServer4 on NuGet website it shows result like following: 当我在NuGet网站上搜索IdentityServer4时,结果如下: 在NuGet网站上的搜索结果




And when I search IdentityServer4 on Visual Studio 2017 it shows result like following: 当我在Visual Studio 2017上搜索IdentityServer4时,它显示如下结果: Visual Studio 2017上的搜索结果

The IdentityServer4 Client class is located in the IdentityServer4.Models namespace which is included in the nuget-package. IdentityServer4 Client类位于nuget-package中包含的IdentityServer4.Models命名空间中。

Adding the using-statement where the model/models are needed should resolve the issue 在需要一个或多个模型的地方添加使用声明应可解决此问题

using IdentityServer4.Models

VS Code was not showing intellisense because of an OmniSharp bug. 由于OmniSharp错误,VS Code未显示智能感知。 Solution to this problem is restarting OmniSharp. 解决此问题的方法是重新启动OmniSharp。

Ctrl + Shift + P and then type Restart OmniSharp Ctrl + Shift + P ,然后键入Restart OmniSharp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 asp.net core 3 和 identityserver4 - asp.net core 3 and identityserver4 IdentityServer4 Asp.Net 核心身份 - IdentityServer4 Asp.Net Core Identity IdentityServer4 无法使用自定义用户存储添加 asp net core 身份 - IdentityServer4 can't add asp net core identity with custom user store 如何通过 IdentityServer4 将 OpenIdConnect 添加到 ASP.NET Core ServerSide Blazor Web 应用程序? - How to add OpenIdConnect via IdentityServer4 to ASP.NET Core ServerSide Blazor web app? 将IdentityServer4集成到ASP.NET Core MVC和API - Integrating IdentityServer4 to ASP.NET Core MVC and API ASP.Net Core-IdentityServer4客户端凭据授权不起作用 - ASP.Net Core - IdentityServer4 client credentials authorization not working ASP.NET Core-依赖注入-IdentityServer4 DbContext - ASP.NET Core - Dependency Injection - IdentityServer4 DbContext ASP.NET Core IdentityServer4 - 声明列表 - ASP.NET Core IdentityServer4 - Claims List 将 ASP.NET Core 标识与 IdentityServer4 结合使用 - 身份验证 - Using ASP.NET Core Identity with IdentityServer4 - Authentication ASP.NET Core 5 + IdentityServer4 不发送刷新令牌 - ASP.NET Core 5 + IdentityServer4 doesn't send refresh token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM