我正在尝试从Azure SDK绞盘运行示例与Azure MFA服务进行通信。该示例在Visual Studio中编译并运行,但是一旦我将其部署到IIS,我就会收到以下错误:
访问被拒绝。
描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中的起源位置的更多信息。
Exception Details: System.Security.Cryptography.CryptographicException: Access is denied.
我怀疑它与向Azure服务进行身份验证所需的证书相关,但不确定如何进行故障排除,因为我不是交易开发人员。证书与ASP应用程序位于同一位置,并在代码中正确引用。同样,代码通过Visual Studio工作。
堆栈追踪:
[CryptographicException: Access is denied.
]
System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) +41
System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName) +0
System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags) +125
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) +141
pf_auth.send_message(String target, String message, String cert_file_path, String& body) +221
pf_auth.pf_authenticate_internal(PfAuthParams pfAuthParams, Boolean asynchronous, String& otp, Int32& call_status, Int32& error_id) +744
MFADemo.example.btnTest_Click(Object sender, EventArgs e) +1602
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11754953
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3619