我正在尝试从CRM插件连接到外部SOAP API。它给了我错误。
我正在使用“隔离模式”作为“无”。 当我使用Console APP连接相同的API时,效果很好。我从服务器执行了控制台APP,它连接并响应良好。
我在Google上找到了一些线索,但可能我缺乏理解/查明问题的能力。
下面的代码段
WebRequest request = WebRequest.Create("URL");
request.Method = "GET";
//request.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
WebResponse response = request.GetResponse();
HttpWebResponse webresponse = (HttpWebResponse)response;
if (webresponse.StatusCode == HttpStatusCode.OK)
{
tracing.Trace($" Resposne is correct i.e OK");
}
当我使用插件注册工具进行调试时,该工具会崩溃并退出。
跟踪错误:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
答案 0 :(得分:0)
原因不起作用:
解决此问题的步骤:在我们的插件代码中,当我们发出HTTP请求时,便向该请求添加了代理。这解决了我们的问题。