G
Guest
I am registering an object for remote access in the constructor of a Windows
Service using the following code:
BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] =
Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["Listen On Port"]);
TcpChannel chan = new TcpChannel(props, null, provider);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyObject),
"MyObject", WellKnownObjectMode.SingleCall);
This seems to work just fine until I attempt to restart the service. If
client applications have accessed the remote object and I attempt to restart
the service, the service stops successfully, but I receive the following
error when it's trying to start up again:
"Only one usage of each socket address (protocol/network address/port) is
normally permitted."
I have to wait a good 5 minutes or so before it will let me use that port
again.
Is there some way in dotnet to force the port to be released so I can
immediatly reuse it?
Service using the following code:
BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] =
Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["Listen On Port"]);
TcpChannel chan = new TcpChannel(props, null, provider);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyObject),
"MyObject", WellKnownObjectMode.SingleCall);
This seems to work just fine until I attempt to restart the service. If
client applications have accessed the remote object and I attempt to restart
the service, the service stops successfully, but I receive the following
error when it's trying to start up again:
"Only one usage of each socket address (protocol/network address/port) is
normally permitted."
I have to wait a good 5 minutes or so before it will let me use that port
again.
Is there some way in dotnet to force the port to be released so I can
immediatly reuse it?