3

I am facing an issue with my socket connection. I have a web Service in Project and It connect to a service installed in the same server. The Service is getting crashed and it has successfully restarted by another monitoring application in our project. But when the web method tries to access the method in the service I am getting a web exception. But when we restart the service manually it works fine. Here is web exception I am getting and Code used.

Code Using

string url = "http://localhost:56789/" + SERVICE_NAME;
m_target = Activator.GetObject(typeof(IWebServiceInterface), url) as IWebServiceInterface;
if (IPAddress.TryParse(ipAddress, out ip))
 {
   status = m_target.Connect(Session.SessionID, username, stationId, ip);           
 }

Web Exception

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 TerminalInterface.IWebServiceInterface.Connect(String sessionId, String username, Int32 stationId, IPAddress ipAddress) at myWebProject.WebServices.Terminal.Service.Connect(String username, Int32 stationId, String ipAddress) 18:42:28.953 ProLog: 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:56789 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 ---

Server stack trace: at System.Net.HttpWebRequest.GetRequestStream() at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessAndSend(IMessage msg, ITransportHeaders headers, Stream inputStream) at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream) at System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncProcessMessage(IMessage msg)

khomyakoshka
  • 1,259
  • 8
  • 18
user1647900
  • 31
  • 1
  • 2

0 Answers0