In my .net 2.0 application, the deleted object suddenly destroyed and threw the following exception. "Failed to connect to the IPC port: the system cannot find the specified file."
I have a remote IPC server and which create a singleton object.
i overrides the InitializeLifetimeService () method and returns null for an infinite lifetime.
Server and client applications work fine, but sometimes we get the exception above.
Servercode:
// create and register processheartbeat. BinaryServerFormatterSinkProvider serverprovider = new BinaryServerFormatterSinkProvider (); serverprovider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; // Sets the Heartbeat object and registers it. processHeartbeatChn = new IpcServerChannel ("HeartbeatChannel", "localhost:" + applicationHeartbeatPort, serverprovider);
ChannelServices.RegisterChannel(processHeartbeatChn, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Heartbeat),
appName, WellKnownObjectMode.Singleton);
ClientCode:
string uri = string.Format(CultureInfo.InvariantCulture,"ipc://localhost:{0}/{1}", applicationHeartbeatPort, appName);
remoteHeartbeat = (Heartbeat)Activator.GetObject(typeof(Heartbeat), uri);
Any fix to fix this problem?
can someone help me?
source
share