views:

2057

answers:

1

Apologies if this question appears twice on stackOverflow

Im trying to run a wcf service on a windows server 2003 box. Im getting a System.ServiceModel.AddressAlreadyInUseException exception when the servicehost calls Open() and it tells gives me the following error:

HTTP could not register URL http://+:8080/LogoResizer/mex/ because TCP port 8080 is being used by another application

Ive read that I need to use the httpcfg.exe to register my namespace and Ive used the GUI tool found here to do it but I still get the above exception. Running "netstat -a" doesnt show anything else listening on port 8080 and running "httpcfg.exe query urlacl" returns me the following registered namespaces.

C:\Program Files\Support Tools>httpcfg query urlacl URL : http://+:80/Temporary_Listen_Addresses/

ACL : D:(A;;GX;;;WD)

URL : http://+:8080/LogoResizer/

ACL : D:(A;;GX;;;WD)

URL : http://+:8080/LogoResizer/mex/

ACL : D:(A;;GX;;;WD)

The config for my app is as below:

<system.serviceModel>
 <bindings>
  <netTcpBinding>
   <binding name="NetTcpBinding_ImageResizerServiceContract" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
                maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647"
         maxStringContentLength="2147483647"
         maxArrayLength="2147483647"
         maxBytesPerRead="2147483647"
         maxNameTableCharCount="2147483647" />
    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
    <security mode="Transport">
     <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
     <message clientCredentialType="Windows" />
    </security>
   </binding>

  </netTcpBinding>
 </bindings>
 <behaviors>
  <serviceBehaviors>
   <behavior name="ServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
   </behavior>
  </serviceBehaviors>
 </behaviors>
 <services>
  <service name="LogoResizer.WCF.ServiceTypes.ImageResizerService" behaviorConfiguration="ServiceBehavior">
   <host>
    <baseAddresses>
     <add baseAddress="http://localhost:900/mex/"/&gt;
     <add baseAddress="net.tcp://localhost:9000/" />
    </baseAddresses>
   </host>
   <endpoint bindingConfiguration="NetTcpBinding_ImageResizerServiceContract" binding="netTcpBinding" contract="LogoResizer.WCF.ServiceContracts.IImageResizerService" />
   <endpoint  address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
 </services>
</system.serviceModel>

Does anyone have any idea what Im doing wrong or how I can register my namespace so I can have a http endpoint for my service?

+2  A: 

Worked it out.

Problem was having both my endpoints running off the same port. This isnt an issue when developing under windows XP, but will give you the exceptions I wrote about when trying to run the service under Vista or windows server 2003. I just needed to update my server config to the following

   <baseAddresses>
                                    <add baseAddress="http://localhost:9000/mex/"/&gt;
                                    <add baseAddress="net.tcp://localhost:9001/" />
                            </baseAddresses>
Dav Evans