我可以通过Windows窗体程序调用第三方供应商的Web服务。当我尝试调用从一个WCF Web服务,我得到了下面的错误相同的Web服务和Web方法和相同的URL:“无法连接到远程服务器”
ExportValuationPolicyNumber:Exception=System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: 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 66.77.241.76:80
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, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TFBIC.RCT.WCFWebServices.ExpressLync.ValuationServiceWse.ExportValuationPolicyNumber(String PolicyNumber) in c:\Source\TFBIC.RCT.WCFWebServices\TFBIC.RCT.WCFWebServices\Web References\ExpressLync\Reference.cs:line 519
at TFBIC.RCT.WCFWebServices.ValuationService.ExportValuationPolicyNumber(String PolicyNumber) in c:\Source\TFBIC.RCT.WCFWebServices\TFBIC.RCT.WCFWebServices\ValuationService.svc.cs:line 97
基本上,我试图写为供应商的.asmx/WSE3一个WCF包装服务。让我们不要错过 - 但微软表示WCF可以调用WSE3,但只有打开SSL,我的供应商才会相信 - 不允许SSL连接。所以我坚持写包装,所以我可以从BizTalk 2009调用。现在,我通过Console程序测试包装。
我甚至可以做些什么来调试?我在WCF服务之前和之后添加了EventLog跟踪,在这里它调用了.asmx服务 - 所以我知道这是它吹来的地方(加上上面错误中的行号)。
我在我的web.config以下:
<microsoft.web.services3>
<diagnostics>
<trace enabled="true"
input="c:\inetpub\wwwroot\wsetraces\InputTrace.webinfo"
output="c:\inetpub\wwwroot\wsetraces\OutputTrace.webinfo" />
<detailedErrors enabled="true" />
</diagnostics>
</microsoft.web.services3>
,我已经给该目录的完全访问每个人 - 但没有跟踪在那里出现。
有什么东西我可以找或尝试旁边调试呢?
从理论上讲,“ping”结果应该不重要,因为该网站正在使用Windows窗体程序进行工作,该窗口程序称它为好。
然而 - 这里是中国平安表示,它看起来有点可疑的对我说:
C:\用户\ uxnxw01>平rct.msbexpress.net
Pinging rct.msbexpress.net [66.77.241.56] with 32 bytes of data:
Reply from 10.193.99.5: Destination net unreachable.
Reply from 10.193.99.5: Destination net unreachable.
Request timed out.
Reply from 10.193.99.5: Destination net unreachable.
Ping statistics for 66.77.241.56:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
感谢,
Neal Walters
WireShark分析
我确实运行过Wireshark - 在下面的评论中发布了一些结果。但是,阅读更多内容后,它并不总是说“Destination Unreachable”。但在失败的情况下,我从来没有得到任何数据。我仍然困惑下一步该做什么。我一直在比较数据包,但速度缓慢且令人困惑。例如,我仍然没有找到在请求数据包中传递的密钥(特定的policyNum)。我还在工作中看到了一些“Destination Unreachable”声明。
在那个工程中,我从来没有看到66.77.241.76,我只看到我们公司的代理。但是我看不到任何会告诉WSE3使用或不使用代理的配置(或代码)。
的Telnet结果:
C:\Users\uxnxw01>telnet 66.77.241.56 80
Connecting To 66.77.241.56...Could not open connection to the host, on port 80:
Connect failed
C:\Users\uxnxw01>telnet 66.77.241.76 80
Connecting To 66.77.241.76...Could not open connection to the host, on port 80:
Connect failed
我不知道这是什么证明。就像我说的那样,我可以通过直接调用它的WSE3接口,从Windows窗体调用相同的Web服务。我知道我可以那样到达那里。
我在想这两个程序的主要区别在于它是在Win Form下运行并直接调用WSE3。那个可以工作。发生故障的基本上是99%相同的代码,作为WCF服务发布,所以它在IIS下运行(然后控制台程序调用我的机器上的WCF/IIS服务,该服务又调用WSE3服务)。
是否有某些原因IIS不会使用相同的代理?
是的,根据我的答案中的第三个选项。 ;-) – 2009-11-18 16:12:18
你也可以做到这一点在web.config中 ' \t <代理usesystemdefault = “假” proxyaddress = “HTTP://your.proxy.ip”/> defaultProxy> ' –
Ketan
2012-07-13 20:53:58