且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“无法连接到远程服务器"错误

更新时间:2022-05-18 08:28:47

使用类似的模式,我的其余客户端正在调用服务API,该服务在调试时成功调用,但无法处理已发布的代码.错误是:无法连接到远程服务器.

With similar pattern, my rest client is calling the service API, the service called successfully when debugging, but not working on the published code. Error was: Unable to connect to the remote server.

内部异常:System.Net.Sockets.SocketException(0x80004005):无法建立连接,因为目标计算机主动拒绝了它服务IP:443在System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)在System.Net.ServicePoint.ConnectSocketInternal处(Boolean connectFailure,Socket s4,Socket s6,Socket&套接字,IPAddress&地址,ConnectSocketState状态,IAsyncResult asyncResult,Exception&Exception)

Inner Exception: System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it serviceIP:443 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)

解决方案::在Web配置中设置代理.

Resolution: Set the proxy in Web config.

<system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy proxyaddress="http://proxy_ip:portno/" usesystemdefault="True"/>
    </defaultProxy>
</system.net>