18

I have a windows service application which works using remoting. It is used to display baloon tip. However, it sometimes throws this error:

Exception :Requested Service not found
Inner Exception : Stack Trace : Server stack trace: at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream) 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 Baloontip.clsBaloonTool.Messagebox(String Message)

Can any body please help me with this issue.

Patrick McDonald
  • 64,141
  • 14
  • 108
  • 120
mathirengasamy
  • 191
  • 1
  • 6

1 Answers1

23

If the error occurs after some time, it is possible that you doesn´t override the InitializeLifetimeService method of the base class MarshalByRefObject.

By default, if you doesn´t override the method, the remote object is destroyed after some time (I think 5 minutes). If you override the method and return null, the object has an endless life time.

public override object InitializeLifetimeService() {
  return null;
}
usr
  • 168,620
  • 35
  • 240
  • 369
Jehof
  • 34,674
  • 10
  • 123
  • 155
  • Man you saved me! I don't know enough about remoting and it would have taken me forever to figure this out without this answer! – Gene S Feb 25 '14 at 23:30
  • 1
    Hi Jehof, you saved me too! I have spent many 5 minutes today for testing the remoting service vanishing problem in my hooking system. Thank you for the great advice! – Houcheng Nov 15 '19 at 08:35