AddIdentityServer() 此调用在以下方法或属性之间不明确

Usa*_*lvi 6 saml single-sign-on saml-2.0 asp.net-identity identityserver4

我的项目运行良好并且构建也很好。但是,当我添加包rsk.identityserver4.saml时,此代码出现错误。

 var builder = services.AddIdentityServer(options =>
            {
                options.Events.RaiseErrorEvents = true;
                options.Events.RaiseInformationEvents = true;
                options.Events.RaiseFailureEvents = true;
                options.Events.RaiseSuccessEvents = true;

                // see https://identityserver4.readthedocs.io/en/latest/topics/resources.html
                options.EmitStaticAudienceClaim = true;
            })
Run Code Online (Sandbox Code Playgroud)

错误是

Severity    Code    Description Project File    Line    Suppression State
Error   CS0121  The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.IdentityServerServiceCollectionExtensions.AddIdentityServer(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<IdentityServer4.Configuration.IdentityServerOptions>)' and 'Microsoft.Extensions.DependencyInjection.IdentityServerServiceCollectionExtensions.AddIdentityServer(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Duende.IdentityServer.Configuration.IdentityServerOptions>)'    IdentityServer  D:\Office\GitHub\NLP\identityserver\IdentityServer\Startup.cs   58  Active

Run Code Online (Sandbox Code Playgroud)

如果我删除这个包,它就会再次正常工作。如何克服这个问题?

错误

小智 7

也许您安装了IdentityServer4Microsoft.AspNetCore.ApiAuthorization.IdentityServer。您必须删除一个再见错误