【发布时间】:2014-04-28 00:43:15
【问题描述】:
我构建了一个 Azure Web 作业控制台,它引用了 Windows Azure 管理库。 我尝试使用公共设置方法对我的应用进行身份验证。
该程序在我的本地运行良好,但在 Azure Web Jobs 上失败并出现 X509Certificates 错误。
这就是我为网络工作计划所做的。
从https://windows.azure.com/download/publishprofile.aspx下载的发布设置文件
-
在控制台应用程序上,通过从设置文件中复制并粘贴订阅 ID 和证书字符串来创建凭据。
new CertificateCloudCredentials( subscriptionId, new 509Certificate2(Convert.FromBase64String(base64EncodedCertificate))); 在 Azure Web 作业上部署并尝试“按需运行”。
-
错误
at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)
执行时出现异常:
System.Security.Cryptography.CryptographicException, The system cannot find the file specified.
【问题讨论】:
-
我解决了这个问题。我们可以制作自己的 *.pfx 并在我们的 webjob 控制台应用程序中使用它。 1.simple-talk.com/cloud/security-and-compliance/…
标签: c# .net security azure x509certificate