gpt4 book ai didi

c# - Windows加密异常: Access is denied when publishing app in Azure

转载 作者:行者123 更新时间:2023-12-03 00:35:58 27 4
gpt4 key购买 nike

我有一个基于 Aridka OpenIddict 示例的非常简单的 Web 应用程序,在授权 Controller 和启动类方面几乎是它的副本,在返回的资源类型方面存在一些差异,但是 token 机制与示例完全相同。

该应用程序在我的开发环境中运行良好(数据库位于 Azure 中,但该应用程序在我的计算机中运行)。但是,我已将其发布到 Azure,只是为了看看它在云提供商中托管后是否仍然有效,但它实际上返回了一个错误并且无法启动。这是堆栈跟踪:

Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Access is denied.
at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilder.AddDevelopmentEncryptionCertificate(X500DistinguishedName subject)
at Microsoft.Extensions.DependencyInjection.OpenIddictServerBuilder.AddDevelopmentEncryptionCertificate()
at MyApp.Api.Startup.<>c.<ConfigureServices>b__4_4(OpenIddictServerBuilder options) in C:\Users\edm\OneDrive\MyAp\1\1\MyApp.Api\Startup.cs:line 75
at Microsoft.Extensions.DependencyInjection.OpenIddictServerExtensions.AddServer(OpenIddictBuilder builder, Action`1 configuration)
at MyApp.Api.Startup.ConfigureServices(IServiceCollection services) in C:\Users\edm\OneDrive\MyApp\1\1\MyApp.Api\Startup.cs:line 54
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at MyApp.Api.Program.Main(String[] args) in C:\Users\edm\OneDrive\MyApp\1\1\MyApp.Api\Program.cs:line 16

我真的很感谢任何帮助。我是 OpenId 的新手,因此如果这是一个太基础的问题,并且我应该首先阅读其他资源,请随时分享引用资料。

谢谢!

编辑

最佳答案

  1. 在门户上添加应用程序设置WEBSITE_LOAD_USER_PROFILE=1

    如果不行,请尝试第二种方法。

  2. 将证书添加到您的网络应用程序。

    Upload certificate to App Service

关于c# - Windows加密异常: Access is denied when publishing app in Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67629592/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com