Cannot access cer text “App setting” in “Application Settings” on Azure share

戏子无情 提交于 2019-12-12 03:44:32

问题


I have a .cer file that I have converted into an "App settings" under "Application Settings" on Azure. I then add the setting key value pair in my app.config file with dummy info (and via "programmagic" is supposed to be updated when running on the Azure... The code works on my machine, but it is not getting pulled from my Azure "App settings" when I run it on Azure ... .

My "App Setting" in "Application Settings" on my MVC5 Web App:

Name: MyCER
Value: -----BEGIN CERTIFICATE----- goobledegookthatrunsfor1600charsOrSo -----END CERTIFICATE-----

My app.config reference:

<appSettings>
  <add key="CERFile" value="TEST"/>
</appSettings>

My code call (This works locally but not on Azure):

    Cert cert = new Cert();
    cert.LoadFromBase64(ConfigurationManager.AppSettings["CERFile"]);

Do I need to set permissions to allow this to work? I am also trying to do the same with my connection strings, and have not gotten that to work either.


回答1:


The correct way of using Certificates in Azure Webapps is https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/

Any other way of constructing X509Certificate2 object will fail on Azure WebApps



来源:https://stackoverflow.com/questions/42076116/cannot-access-cer-text-app-setting-in-application-settings-on-azure-share

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!