【发布时间】:2014-01-02 13:44:03
【问题描述】:
我有一个作为 Windows 服务运行以连接到 Web 服务的客户端。我在可以从浏览器访问 Web 服务的虚拟机上运行该 Windows 服务;但是,当我尝试从客户端运行服务时,它不起作用。
这里是例外:
System.ServiceModel.EndpointNotFoundException:在http://pmht.plexxis.com/clientsdk.asmx 处没有可以接受消息的端点侦听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。 ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 连接尝试失败,因为连接方在一段时间后没有正确响应,或建立连接失败,因为连接的主机未能在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket & socket) 的 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 响应 10.0.1.96:80 , IPAddress& 地址, ConnectSocketState 状态, IAsyncResult asyncResult, Exception& 异常) --- 内部异常堆栈跟踪结束 --- 在 System.Net.HttpWebRequest.GetRequestStream() 的 System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) 在 System. ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() --- 内部异常堆栈跟踪结束 --- 服务器堆栈跟踪:位于 System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() 处System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan 超时)在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime 操作,对象 [] 输入,对象 [] 输出, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies。 RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型) 在 Client.Core.PMH.Cli entSDKSoap.Login(Int32 ClientId, String Key) at Client.Core.PMH.ClientSDKSoapClient.Login(Int32 ClientId, String Key) at Client.Core.ClientService.OnStart(String[] args)
我尝试使用 Fiddler Web Debugger 来确定发生了什么;然而,无济于事。它表明没有任何东西被发送或接收。我还想指出,如果我回滚虚拟机,它可以工作。
就在此故障开始之前,我重新启动了 VM。当计算机启动时,我看到了一些关于公钥证书的信息;我认为这可能与问题有关。我用谷歌搜索并尝试了推荐的方法,结果是一样的,所以我不能 100% 确定这与问题有关。此外,另一个 VM 可以毫无问题地连接。
编辑: 基于 cmets,我尝试从 VM ping 站点。请求超时;但是,然后我做了一个 ipconfig /flushdns 并开始解决。不幸的是,同样的异常又被抛出了。
如何开始调试此类问题?
【问题讨论】:
-
从 VM 中,您能否 ping Web 服务器(如果它正在接受连接)。可能虚拟机没有正确解析域。
-
我尝试了您的建议并更新了问题。问题依然存在。
-
这很奇怪,好吧。所以我试了两次,都失败了。然后我写了我的评论并ping了-t。大约 250 次 ping 后,我决定再次运行 Web 服务,它成功了! @aaroncatlin 请将您的评论作为答案。
-
我在下面添加了我的答案。很高兴我能帮上忙。
标签: c# .net web-services sockets