无连接可以作出,因为目标机器积极地在System.Net.Sockets.Socket拒绝它127.0.0.1:57240 [英] No connection could be made because the target machine actively refused it 127.0.0.1:57240 at System.Net.Sockets.Socket

查看:2031
本文介绍了无连接可以作出,因为目标机器积极地在System.Net.Sockets.Socket拒绝它127.0.0.1:57240的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个Web服务,一个窗口服务,我已经部署了Web服务是在另一个服务器,我在自己的服务器上部署的工程的窗口服务,所以我用Windows服务来调用Web服务。一切都很好,但过几天我收到了如下消息:

  System.Net.WebException:无法连接到远程服务器---> 
System.Net.Sockets.SocketException:无连接可以作出
,因为目标机器积极地拒绝它在
System.Net.Sockets.Socket 127.0.0.1:57240
。 DoConnect(端点endPointSnapshot,SocketAddress的
的SocketAddress)在System.Net.Sockets.Socket.InternalConnect(端点remoteEP)
。在
System.Net.ServicePoint.ConnectSocketInternal(布尔connectFailure,S4插座,插座
S6,插座及放大器;插座,ip地址和放大器;地址,ConnectSocketState状态,IAsyncResult的asyncResult,的Int32超时,异常和放大器;除外)
---内部异常堆栈跟踪的结尾 -
- 在系统。 Net.HttpWebRequest.GetRequestStream(TransportContext&安培;上下文)
在System.Net.HttpWebRequest.GetRequestStream()
在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串methodName的,对象[]参数)


解决方案

由于目标机器积极拒绝了127.0.0.1:57240




目标机在这种情况下是在其上失败的代码运行的计算机。的的远程计算机。 127.0.0.1是本地主机的IP地址,你用它来得到了的相同的机器上运行,通过套接字来互相交谈两个过程。不寻常,它可以使用例如命名管道更容易的选择。



当然,你希望它连接到的其他的机器,一个实际上有一个应用程序的聆听。什么是错的与您的程序的配置,它试图连接到不存在的服务。有一个在怎么会发生,你的问题是缺少究竟如何选择的目标机器上的所有细节没有洞察。如果按名称,而不是IP地址,选中然后有一些非常扭曲与局域网中的命名服务回事。或者你根本忘了更改配置,当你从测试模式部署模式了。或者,你放弃了一堆东西,因为防火墙阻止访问,没有工作。


I have been developing a web service and a windows service, the web service I have deployed is in another server, and the windows service I have deployed works in my own server, so I use the windows service to call the web service. Everything was fine, but in a few days I have received the below message:

System.Net.WebException: Unable to connect to the remote server ---> 
System.Net.Sockets.SocketException: No connection could be made 
because the target machine actively refused it 127.0.0.1:57240
at 
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress 
socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
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(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

解决方案

because the target machine actively refused it 127.0.0.1:57240

The "target machine" in this case is the machine on which the failing code is running. Not the remote machine. 127.0.0.1 is the IP address of "localhost", you use it to get two processes that run on the same machine to talk to each other through sockets. Not unusual, it can be an easier alternative to using named pipes for example.

But of course you expect it to connect to another machine, one that actually has an application listening. Something is wrong with your program's config, it is trying to connect to a service that doesn't exist. There's no insight in how that could have happened, your question is missing all details about exactly how you selected the target machine. If you selected it by name rather than IP address then there's something very screwy going on with the naming service on your LAN. Or you simply forgot to change the config when you went from testing mode to deployment mode. Or you gave up trying a bunch of stuff that didn't work because the firewall is blocking access.

这篇关于无连接可以作出,因为目标机器积极地在System.Net.Sockets.Socket拒绝它127.0.0.1:57240的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆