18
votes

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.

1
Please post the code that is causing this exception to appear.cjk

1 Answers

23
votes

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;
}