c# - 在 asp.net core DataProtection api 中找不到 ProtectKeysWithCertificate 方法

标签 c# asp.net asp.net-core openiddict

在这一行添加 ProtectKeysWithCertificate 时出现编译时错误

public IServiceProvider ConfigureServices(IServiceCollection services)
{
    services.AddDataProtection()
        .SetApplicationName("Testervice")
        .ProtectKeysWithCertificate(newCert);
        //compile time error on ProtectKeysWithCertificate line
       //method not found
}

最佳答案

如图所示in the documentation , ProtectKeysWithCertificate() 在 .NET Core 1.0/1.1 (netcoreapp1.x) 上不可用。

如果您想使用它,您可以针对完整的 .NET Framework(例如 net461)。

关于c# - 在 asp.net core DataProtection api 中找不到 ProtectKeysWithCertificate 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45014590/

相关文章:

asp.net - 什么是 aspnet_Users 和 aspnet_Membership?我应该使用哪一个?有什么区别?

c# - 如何使用反射或其他准确方法获取 Controller 内部的当前 ASP.NET 核心 Controller 方法名称

ASP.NET session Cookie - 指定基域

asp.net 核心身份声明与属性(效率观点)

c# - 为什么 ASP.NET Core 3.1 应用程序中的 appsettings 中的 Appinsight 日志级别被忽略?

c# - UWP 绑定(bind)到依赖属性

c# - 线程并行编程

c# - 正确包含一个带有 .NET 核心的项目

c# - 将Access DB中的图片读入PictureBox

asp.net - 如何配置RedisSessionStateProvider来使用Redis哨兵?