在这一行添加 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/