0

我需要绕过 Dynamics AX 2009 中使用的 HttpWebRequest 上的证书错误。我发现一些在 .NET 中运行良好的花哨代码:

private bool ValidateCert(object sender,   
    X509Certificate cert,   
    X509Chain chain,   
    System.Net.Security.SslPolicyErrors error)  
{  
    return true;  
}  

private void Form1_Load(object sender, EventArgs e)  
{  
    System.Net.ServicePointManager.ServerCertificateValidationCallback +=   
        new System.Net.Security.RemoteCertificateValidationCallback(ValidateCert);  
} 

但是,似乎 System.Net.Security.RemoteCertificateValidationCallback 无法通过 Dynamicx AX 访问。有什么解决方法可以让它工作吗?(除了制作 .NET dll 并将其附加到 Axapta 之外)

4

1 回答 1

0

您可以将无效证书添加到本地计算机受信任的根证书颁发机构(从Using a self-signed certificate with .NET's HttpWebRequest/Response 中窃取答案)。

Ax 中最棘手的部分是将其安装在适当的位置并允许 Ax 用户访问它(特别是如果您从 AOS 调用 Web 服务)。

如果您从客户端调用 Web 服务,则需要在所有客户端上安装它(或在进行调用的 AOS 上调用代码并在服务器上安装证书)。

于 2012-02-02T09:44:38.587 回答