我可以从 Windows 窗体程序调用第 3 方供应商的 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 调用。现在,我正在通过控制台程序测试包装器。
我什至可以做些什么来调试?我在调用 .asmx 服务的 WCF 服务之前和之后添加了 EventLog 跟踪 - 所以我知道这就是它正在发生的地方(加上上面错误中的行号)。
我的 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 窗体程序工作。
尽管如此 - 这是 Ping 显示的内容,对我来说它看起来有点可疑:
C:\Users\uxnxw01>ping 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),
谢谢,
尼尔·沃尔特斯
WireShark 分析
我确实运行了 Wireshark - 在下面的评论中发布了一些结果。不过,多读后,它并不总是说“Destination Unreachable”。但在它失败的情况下,我永远不会得到任何数据回传。我仍然很困惑下一步该做什么。我一直在比较数据包,但它很慢而且令人困惑。例如,我仍然没有找到我在请求数据包中传递的密钥(特定的 policyNum)。我还在有效的语句中看到了一些“无法到达的目标”语句。
在有效的那个中,我从来没有看到 66.77.241.76,我只看到我们公司的代理。但我在配置(或代码)中看不到任何告诉 WSE3 使用或不使用代理的内容。
远程登录结果:
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 不使用相同的代理是否有某些原因?