Unable to reuse remoting port

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?
 
G

Guest

I have a remoting app too; but have not faced your case. My app uses 9000
port by default and I can restart it using the same port again with no
problem!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top