G
Guest
Hi,
I wrote a remoting object and published it like this:
public class RemoteLogger : MarshalByRefObject
{
// Contain some methods...
}
public class RemoteManager
{
private TcpChannel m_Channel = null;
private RemoteLogger m_RemoteLogger = null;
public void Initialize(string port)
{
// Registering the channel
BinaryClientFormatterSinkProvider clientProvider = null;
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary APIprops = new Hashtable();
APIprops["port"] = port;
APIprops["name"] = "Logger";
APIprops["typeFilterLevel"] = TypeFilterLevel.Full;
m_Channel = new TcpChannel(port, clientProvider, serverProvider);
ChannelServices.RegisterChannel(m_Channel);
// Creating a normal local instance of Logger API object and Marshal it.
// This will register the EventsManager as a running singleton object.
// When the clients calls Activator.GetObject it will connect to this
running instance.
m_RemoteLogger = new RemoteLogger();
RemotingServices.Marshal(m_RemoteLogger, "MyLoggerUri");
}
Other application uses this remote logger fine, But after a while (only a
few minutes) of no activity with this remote logger, and then trying to use
any of its methods cause en exception throwing as follow:
"An unhandled exception of type 'System.Runtime.Remoting.RemotingException'
occurred in mscorlib.dll
Additional information: Requested Service not found"
As I understand my RemoteLogger life time should be infinite because it was
created by local new and the reference for it never released.
Can anybody tell what is the problem?
Should I add the InitializeLifetimeService() for the RemoteLogger to return
null?
If I do add the InitializeLifetimeService(), how can I free it manually by
code when the RemoteManager whishes to free it?
I wrote a remoting object and published it like this:
public class RemoteLogger : MarshalByRefObject
{
// Contain some methods...
}
public class RemoteManager
{
private TcpChannel m_Channel = null;
private RemoteLogger m_RemoteLogger = null;
public void Initialize(string port)
{
// Registering the channel
BinaryClientFormatterSinkProvider clientProvider = null;
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary APIprops = new Hashtable();
APIprops["port"] = port;
APIprops["name"] = "Logger";
APIprops["typeFilterLevel"] = TypeFilterLevel.Full;
m_Channel = new TcpChannel(port, clientProvider, serverProvider);
ChannelServices.RegisterChannel(m_Channel);
// Creating a normal local instance of Logger API object and Marshal it.
// This will register the EventsManager as a running singleton object.
// When the clients calls Activator.GetObject it will connect to this
running instance.
m_RemoteLogger = new RemoteLogger();
RemotingServices.Marshal(m_RemoteLogger, "MyLoggerUri");
}
Other application uses this remote logger fine, But after a while (only a
few minutes) of no activity with this remote logger, and then trying to use
any of its methods cause en exception throwing as follow:
"An unhandled exception of type 'System.Runtime.Remoting.RemotingException'
occurred in mscorlib.dll
Additional information: Requested Service not found"
As I understand my RemoteLogger life time should be infinite because it was
created by local new and the reference for it never released.
Can anybody tell what is the problem?
Should I add the InitializeLifetimeService() for the RemoteLogger to return
null?
If I do add the InitializeLifetimeService(), how can I free it manually by
code when the RemoteManager whishes to free it?