亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將密鑰保管庫添加到我的應用程序會導致發布時出現啟動錯誤(在本地工作)

將密鑰保管庫添加到我的應用程序會導致發布時出現啟動錯誤(在本地工作)

C#
拉丁的傳說 2023-05-13 15:53:03
每當我將 Azure Key Vault 應用配置添加到我的 program.cs 文件時,我的 Web 應用都會遇到啟動錯誤 500.30。在本地,我可以訪問保險庫并對其進行了測試,但一旦發布,我就會收到錯誤消息。我已經嘗試將系統和用戶身份添加到我的 Web 應用程序,并通過 Azure 訪問控制和訪問策略授予它權限。我也已授予該應用程序訪問整個資源的權限。我已經注釋掉了這部分并且應用程序運行了,這就是為什么我將錯誤歸因于密鑰庫。public static IWebHost CreateWebHostBuilder(string[] args) =>           WebHost.CreateDefaultBuilder(args)// this gets commented out to run properly               .ConfigureAppConfiguration((ctx, builder) =>               {                   var keyVaultEndpoint = GetKeyVaultEndpoint();                   if (!string.IsNullOrEmpty(keyVaultEndpoint))                   {                       var azureServiceTokenProvider = new AzureServiceTokenProvider();                       var keyVaultClient = new KeyVaultClient(                           new KeyVaultClient.AuthenticationCallback(                               azureServiceTokenProvider.KeyVaultTokenCallback));                       builder.AddAzureKeyVault(                           keyVaultEndpoint, keyVaultClient, new DefaultKeyVaultSecretManager());                   }               }               ) // until here                .UseStartup<Startup>()               .Build();private static string GetKeyVaultEndpoint() => "https://<vault name>.vault.azure.net/";我希望能夠訪問密鑰庫。該應用程序在發布時拋出 HTTP 錯誤 500.30 - ANCM 進程內啟動失敗。更新:更改為 OutOfProcess 后,我現在收到錯誤 502.5。帶有以下消息:Unhandled Exception: Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProviderException: Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/<MyId>. Exception Message: Tried the following 3 methods to get an access token, but none of them worked.Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority: https://login.windows.net/<MyId>. Exception Message: Tried to get token using Managed Service Identity. Access token could not be acquired. Failed after 5 retries. MSI ResponseCode: BadRequest, Response: 
查看完整描述

1 回答

?
ibeautiful

TA貢獻1993條經驗 獲得超6個贊

我能夠重現同樣的問題,但我得到了同樣的錯誤,要解決這個問題,請嘗試以下操作:

打開您的 *.csproj 文件,找到Property group tag 并將其更新為:

 <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>       
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
    <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
  </PropertyGroup>

嘗試看看是否有幫助。


查看完整回答
反對 回復 2023-05-13
  • 1 回答
  • 0 關注
  • 110 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號