[英]Converting a PNG returned from an API to a JPG, then to a Base64 encoded string in an Azure function
[英]Creating Certificate from base64 encoded string failing in Azure Function
我正在嘗試從 base64 編碼字符串創建X509Certificate2
。 我已將此代碼添加到示例 Azure function 中。 在本地代碼有效,我可以從 bas364 編碼字符串創建證書 object,但是在發布到 Azure 時出現異常
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore
遵循https://github.com/dotnet/runtime/issues/30658我將應用服務計划保留為“(P1v2:1)”,這不是共享。
Use WEBSITE_LOAD_CERTIFICATES
app setting in your azure function the specified certificates accessible to your Windows hosted app in the Windows certificate store, in Current_User\Your_user .
在您的代碼中,通過證書指紋訪問證書。 像certificateThumbprint = "<your certificate thumbprint>";
注意:應用服務將證書路徑注入 Windows 容器。 像變量
WEBSITE_PRIVATE_CERTS_PATH
、WEBSITE_INTERMEDIATE_CERTS_PATH
、WEBSITE_PUBLIC_CERTS_PATH
和WEBSITE_ROOT_CERTS_PATH
。 確保您必須使用環境變量引用證書路徑,而不是對證書路徑進行硬編碼。
如果仍然存在,您也面臨同樣的問題,您可以在您的應用中添加WEBSITE_LOAD_USER_PROFILE=1
應用設置。 該錯誤表示特定用戶無法訪問該證書。 它將解決您的問題。
請參閱此處了解更多信息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.