c# - Web服务: How to debug System.Net.WebException?

标签 c# .net web-services sockets

我有一个作为Windows服务运行的客户端,可以连接到Web服务。我在虚拟机上运行了Windows服务,该虚拟机可以从浏览器访问Web服务。但是,当我尝试从客户端运行服务时,它将无法正常工作。

这是异常(exception):

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://pmht.plexxis.com/clientsdk.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> 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 10.0.1.96: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, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() at 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 timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Client.Core.PMH.ClientSDKSoap.Login(Int32 ClientId, String Key) at Client.Core.PMH.ClientSDKSoapClient.Login(Int32 ClientId, String Key) at Client.Core.ClientService.OnStart(String[] args)



我尝试使用Fiddler Web调试器来确定正在发生的事情。但是,无济于事。它表明什么也没有发送或接收。我还想指出,如果我回滚虚拟机,它就可以工作。

在此故障开始之前,我重新启动了VM。当计算机启动时,我看到了一些有关公钥证书的信息。我认为这可能与问题有关。我用谷歌搜索并尝试了建议的结果,结果是相同的,所以我不是100%确定这与问题有关。此外,另一个VM可以毫无问题地连接。

编辑:
根据评论,我尝试从VM ping通该站点。请求超时;但是,然后我做了一个ipconfig/flushdns,它开始解析。不幸的是,再次抛出了相同的异常。

我如何开始调试这种类型的问题?

最佳答案

如注释中所述,请确保通过尝试ping域来确保VM能够正确解析Web服务名称。

如果不能,请尝试刷新DNS。

关于c# - Web服务: How to debug System.Net.WebException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20884359/

相关文章:

c# - 如何将组合框的数据表示为整数

c# - 使用 .NET Regex 进行泰米尔语全词搜索

c# - DateTime.Parse Extract 的参数不正确问题

web-services - 如何在 Play Framework scala ws 调用中忽略 ssl 验证

web-services - 验证服务器 - 什么是好的方法?

c# - 为什么我收到错误 No overload for ... matches delegate?

c# - 创建给定类型的空枚举

c# - 填写下拉列表并将分配的产品计数附加到每个

.net - DateTime.Now.ToString ("yyyy-MM-dd hh:mm:ss")返回的是上午时间而不是下午时间?

java - 如何使 JAX-WS 对 SOAP 使用 https(http 到 https):address in generated wsdl