tags:

views:

241

answers:

1

I'm connection IBM.Iseries database in a c# application using ADO.NET iSeries drivers. My WCF service is throwing the error as

"HTTP could not register URL http://+:80/Temporary_Listen_Addresses/771be107-8fa3-46f9-ac01-12c4d503d01e/ because TCP port 80 is being used by another application."

 <system.serviceModel>
<client>
  <endpoint address="http://localhost:8080/Design_Time_Addresses/DataAccessLayer/POEngine/"
    binding="wsDualHttpBinding"  bindingConfiguration="" contract="POServiceReference.IPOEngine"
    name="MyPoBindings">
    <identity>
      <dns value="localhost" />
    </identity>
  </endpoint>
  <endpoint address="http://localhost:8080/Design_Time_Addresses/DataAccessLayer/POEngine/"
    binding="wsDualHttpBinding" bindingConfiguration="PoBindings1"
    contract="POServiceReference.IPOEngine" name="PoBindings">
    <identity>
      <dns value="localhost" />
    </identity>
  </endpoint>
</client>
<bindings>
  <wsDualHttpBinding>
    <binding name="PoBindings1" closeTimeout="00:01:00" openTimeout="00:01:00"
      receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
      transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
      textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" />
      <security mode="Message">
        <message clientCredentialType="Windows" negotiateServiceCredential="true"
          algorithmSuite="Default" />
      </security>
    </binding>
  </wsDualHttpBinding>
  <wsHttpBinding>
    <binding name="PoBindings" />
  </wsHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="DataAccessLayer.POEngineBehavior"
    name="DataAccessLayer.POEngine">
    <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration=""
      name="PoBindings" contract="DataAccessLayer.IPOEngine">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/Design_Time_Addresses/DataAccessLayer/POEngine/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="NewBehavior" />
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="DataAccessLayer.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="DataAccessLayer.POEngineBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>  </system.serviceModel>

Having the problem also without using any IBM data access. A normal Hello World is also throwing the error.Where i need to change the port address

+1  A: 

The "problem" is that you're using a wsDualHttpBinding, intended for duplex contracts (the server calls back to the client). Do you need this functionality? If you do, you will need to provide it an address for the client to listen on by specifying a clientBaseAddress in your binding configuration. Additionally, you will need tell the endpoint to use the PoBindings1 binding configuration.

WCF will automatically append a GUID to the base address, to ensure it generates a unique endpoint address, but of course it needs a port number it can listen on. See this MSDN page for documentation of the configuration section. It should look roughly like this:

<system.serviceModel>
    <!-- client section omitted -->
    <bindings>
        <wsDualHttpBinding>
            <binding name="PoBindings1"
                     clientBaseAddress="http://localhost:8080/Callbacks/"&gt;
                <!-- extra config elements and attributes omitted -->
            </binding>
        </wsDualHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="DataAccessLayer.POEngineBehavior"
            name="DataAccessLayer.POEngine">
            <endpoint address=""
                      binding="wsDualHttpBinding"
                      bindingConfiguration="PoBindings1"
                      name="PoBindings" contract="DataAccessLayer.IPOEngine">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:8080/Design_Time_Addresses/DataAccessLayer/POEngine/" />
                </baseAddresses>
            </host>
        </service>
    </services>
    <!-- behaviors omitted -->
</system.serviceModel>

This is what a service contract typically looks like if you're using duplex contracts:

[ServiceContract(CallbackContract = typeof(IMyCallbackContract))]
interface IMyContract
{
    [OperationContract]
    void DoSomething();
}

interface IMyCallbackContract
{
   [OperationContract]
   void OnCallback();
}

If you don't need callback functionality, you should be using WSHttpBinding, or one of the other "simple" bindings. Here's a list of binding types that come with WCF.

Thorarin
When ever i stopped iis the service is working
renjucool
i need wsDualHttpBinding as the wcf service need to communicate with windows workflow in a duplex mode.
renjucool
@renjucool: That makes sense, because it's using port 80. Tell it to use another port like shown in the config above.
Thorarin
@Thorarin ok thank you
renjucool