I have Windows Service that uses a WCF service host to listen for connections on TCP port 61000. When I try to start the service, I get the error:

Service cannot be started. System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:61000/ because TCP port 61000 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process
   at System.Net.HttpListener.AddAll()
   at System.Net.HttpListener.Start()
   at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
   --- End of inner exception stack trace ---
   at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
   at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   at...

A quick netstat -a shows there is nothing listening on port 61000. I've also found several posts online that mention reserving namespaces using netstat, but the account that the service runs under has administrator privileges so that shouldn't be necessary.

Any other ideas as to why I'm getting this message?

This service is running on 64-bit Windows Server 2008 R2 Standard.

link|improve this question
What happens if you telnet to port 61000? Any reply? – AliGibbs Feb 15 '11 at 19:33
@Ali - alright this is weird, after restarting the server, the service started just fine and it's now listening on 61000 as designed. I tried a telnet localhost 61000 when it wasn't working before and received a "could not connect to host" error. I'm still wondering how a port could already be in use if netstat says otherwise! – John Rasch Feb 15 '11 at 19:55
Wierd but hopefully resolved :) – AliGibbs Feb 15 '11 at 20:46
feedback

1 Answer

Sometimes a server restart is all that is needed to fix mysterious problems.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.