Blog from Saravanan Arumugam

Let us talk about Technologies

HTTP could not register URL … because TCP port 80 is being used by another application


When I used a Duplex channeled binding (wsDualHttpBinding), during the run time I received the following exception.

Exception:

HTTP could not register URL http://+:80/Temporary_Listen_Addresses/634f73f6-c612-4441-acf8-79ddd5c62f98/ because TCP port 80 is being used by another application.

This is because the port 80 is being used by the IIS (the default web site uses Port 80) and the callback from the service attempts to register the same port for communication.

Solution:

The solution to this is to instruct the WCF to use a different port. I had to add the following binding configuration.

    <bindings>

      <wsDualHttpBinding>

        <binding name="wsDualHttpBinding_IGreetingService" 

         clientBaseAddress="http://localhost:8088/clientCallbackUrl">

        </binding>

      </wsDualHttpBinding>

    </bindings>

I also had to specify the bindingConfiguration in endpoint to point to this.

<endpoint address="ws" binding="wsDualHttpBinding" 
contract="DuplexChannel.IGreetingService" 
bindingConfiguration="wsDualHttpBinding_IGreetingService"/>

 

But unfortunately specifying the clientBaseAddress in service configuration doesn’t take part in the WSDL. As a result clientBaseAddress won’t show up in the client side config. There is no negotiation happening during the runtime either.

So instead of providing the clientBaseAddress in the service side, create the proxy and config as usual and then provide the clientBaseAddress by modifying the client side configuration.

As a result, the client side configuration should typically be looking like this.

<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
              <binding name="WSDualHttpBinding_IGreetingService"
                 clientBaseAddress="http://localhost:8088/clientCallbackUrl">
                <security mode="Message">
                  <message clientCredentialType="Windows" 
                          negotiateServiceCredential="true"
                      algorithmSuite="Default" />
                </security>
              </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:54927/GreetingService.svc/ws"
                 binding="wsDualHttpBinding" 
                 contract="GreetingService.IGreetingService"
                 bindingConfiguration="WSDualHttpBinding_IGreetingService"
                 name="WSDualHttpBinding_IGreetingService">
                <identity>
                    <userPrincipalName value="xxx\xxxx" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

Note: By default the Visual Studio would not be able to register even http://localhost:8088/clientCallbackUrl if it is used for the first time due to security constraints.

Refer to HTTP could not register URL for further detail.

An alternate solution to using netsh command is to run the Visual Studio itself in Administrator mode.

Advertisements

4 responses to “HTTP could not register URL … because TCP port 80 is being used by another application

  1. Pingback: Simple Duplex Contract Implementation « Blog from Saravanan Arumugam

  2. avtobazar April 15, 2011 at 5:54 am

    Thanks – where is article source?

  3. Richard Haber July 12, 2012 at 5:13 pm

    Here I am over a year later and you’ve helped me solve a problem that just started happening today after a Windows 7 update. Had been working OK for many month and then stopped. But you fixed it!

  4. Pingback: HTTP could not register URL … because TCP port 80 is being used by another application | Blog from Saravanan Arumugam | tarakvbhatt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: