When connecting to the WCF service, the exception crashes, although the config.config does not explicitly specify port 80:

An unhandled exception of type 'System.ServiceModel.AddressAlreadyInUseException' occurred in System.ServiceModel.dll

Additional information: HTTP could not register URL http: // +: 80 / Temporary_Listen_Addresses / c3e45f68-abf2-4847-95a6-cfd3f512fc54 / because TCP port 80 is being used by another application.

The strangest thing is that exception on one PC and not on the other. What could be the problem?

client app.config :

 <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> </startup> <system.serviceModel> <bindings> <wsDualHttpBinding> <binding name="wsEndpoint" /> </wsDualHttpBinding> </bindings> <client> <endpoint address="http://localhost:50055/Service" binding="wsDualHttpBinding" bindingConfiguration="wsEndpoint" contract="ServiceReference1.IChatServerService" name="wsEndpoint"> </endpoint> </client> </system.serviceModel> </configuration> 

app.config server:

 <configuration> <system.web> <compilation debug="true" /> </system.web> <system.serviceModel> <services> <service behaviorConfiguration="ServiceBehaviour0" name="Services.Concrete.ChatServerService"> <endpoint address="ws" binding="wsDualHttpBinding" name="wsEndpoint" contract="Services.Abstracts.IChatServerService" /> <endpoint address="mex" binding="mexHttpBinding" name="mexEndpoint" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:50055/Service/"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ServiceBehaviour0"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> 
  • Is there no manipulation inside the service with port 80? - Streletz
  • @Streletz, no, not done. - Lightness
  • Add to this: you can see who captured port 80 like this: netstat -anb > ports.txt . In my case it was Skype. - nzeemin

1 answer 1

You are using wsDualHttpBinding . In this mode, the client listens to some address where it waits for responses from the server. And this is the address that you didn’t ask in the config, and is on port 80m by default!

Use the clientBaseAddress attribute to specify a return address on the client:

  <wsDualHttpBinding> <binding name="wsEndpoint" clientBaseAddress="http://localhost:50055/Client/" /> </wsDualHttpBinding> 

Or use other connection methods. So, netTcpBinding - and without a return address can transmit messages in both directions. Somewhere else in WCF there is support for web sockets, but I don’t remember where.


Now why can the 80th port be busy on some computers? Most likely, this is Skype, which uses this port by default:

Skype screenshot

But, of course, you should not discard the usual version of a web server, Apache, Nginx or Tomcat. But IIS is "friends" with WCF, because they use the same HTTP.SYS.