.NET remoting exception: Exception in the Socket#33711845::DoBind - Only one usage of each socket ad
- by wollemi
Hi All,
I'm attempting to setup a simple remoting windows service and getting the following error when starting the service:
"System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
System.Net.Sockets Verbose: 0 : [4180] ExclusiveTcpListener#4032828::Start()
System.Net.Sockets Verbose: 0 : [4180] Socket#33711845::Bind(0:9998#9998)
System.Net.Sockets Error: 0 : [4180] Exception in the Socket#33711845::DoBind - Only one usage of each socket address (protocol/network address/port) is normally permitted
".
In the windows service application I have the following code in the "OnStart" method - the error occurs when registering the Channel - ChannelServices.RegisterChannel(tcpPipe, true); As far as I can tell there are no other processes using port 9998 ...
Your help to resolve this is most appreciated!
protected override void OnStart(string[] args)
{
int portNumber = int.Parse(ConfigurationManager.AppSettings["endPointTCPPort"]);
TcpChannel tcpPipe = new TcpChannel(portNumber);
ChannelServices.RegisterChannel(tcpPipe, true);
Type serviceType = Type.GetType("TractionGatewayService.TractionGateway");
try
{
RemotingConfiguration.RegisterWellKnownServiceType(serviceType, "updateCustomerDetails", WellKnownObjectMode.SingleCall);
}
catch (RemotingException e)
{
EventLog.WriteEntry("unable to establish listening port because " + e.message;
ChannelServices.UnregisterChannel(tcpPipe);
}
w