我有一个基于IdentityServer3和.NET Framework构建的可用Auth服务。我正在构建IdentityServer4和ASP.NET Core的新版本。在开发的早期阶段,我仍在使用AddDeveloperSigningCredential
。当我将其部署到我的本地开发框(Windows 10)中的控制台窗口时,它运行良好。当我将其部署到我的本地开发框上的IIS Express时,它在启动时出现以下错误:
UnauthorizedAccessException: Access to the path 'C:\Program Files\IIS Express\tempkey.rsa' is denied.
我并不在意它是否能在IIS Express上运行(因为它在控制台窗口中可以正常运行),但我在这里提供这些信息以防它与我的问题有关。
当我将解决方案部署到运行IIS的远程服务器(Windows Server 2008 R2,IIS 7.5)时,它在启动时会失败,并显示以下错误:
Application startup exception:
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Object was not found
at System.Security.Cryptography.CngKeyLite.GenerateNewExportableKey(String algorithm, Int32 keySize)
at System.Security.Cryptography.RSAImplementation.RSACng.GetDuplicatedKeyHandle()
at System.Security.Cryptography.RSAImplementation.RSACng.ExportKeyBlob(Boolean includePrivateParameters)
at System.Security.Cryptography.RSAImplementation.RSACng.ExportParameters(Boolean includePrivateParameters)
at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, Boolean persistKey, String filename)
at Orvis.Authorization.Service.Startup.ConfigureServices(IServiceCollection services) in C:\Workspaces\Orvis\orvis-microservices\orvis-authorization\Orvis.Authorization.Service\Startup.cs:line 20
IdentityServer4和特别是AddDeveloperSigningCredential
是否能在Windows Server 2008 R2和IIS 7.5上运行,或者我需要一个更新的开发服务器?如果操作系统的年龄不是问题,那么还有什么可能导致这个错误呢?