Emil Solakov
8/24/2004 2:18:00 PM
Hi all,
I have a Remoting application that using http channel.
When I tried to make Windows Service from this application all seems to be
all right until I restart service. I have the following Exception.
Service cannot be started. System.Net.Sockets.SocketException: Only one
usage of each socket address (protocol/network address/port) is normally
permitted
at
System.Runtime.Remoting.Channels.Http.HttpServerChannel.StartListening(Objec
t data)
at System.Runtime.Remoting.Channels.Http.HttpServerChannel.SetupChannel()
at System.Runtime.Remoting.Channels.Http.HttpServerChannel..ctor(String
name, Int32 port, IServerChannelSinkProvider sinkProvider)
Service OnStop method is:
_httpChannel.StopListening(null);
ChannelServices.UnregisterChannel(_httpChannel);
_httpChannel = null;
GC.Collect();
GC.WaitForPendingFinalizers();
But it doesn't help. I must wait around 20 seconds before start service
again.
Is there a way to stop HttpServerChannel's socked immediately, because
otherwise I can't restart my service.
Thanks in advance.