system.servicemodel.addressalreadyinuseexception in C# web service client
<p>I have a web service client. The web service is written in JAVA and i m accessing in C# as a client. Here is the app.config file


  
    
      
      
        
        
        -->
      
    
  </p>

<pre><code>&lt;system.serviceModel&gt;
    &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
            &lt;binding name="comboWSPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="enqueueWSPortBinding" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="loginWSPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="recordWSPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="rtcWSPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="reportWSPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="enqueueWSPortBinding1" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="loginWSPortBinding1" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="recordWSPortBinding1" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="reportWSPortBinding1" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
            &lt;binding name="rtcWSPortBinding1" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
    &lt;/bindings&gt;
    &lt;client&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/comboWSPort"
            binding="basicHttpBinding" bindingConfiguration="comboWSPortBinding"
            contract="comboServices.comboWSDelegate" name="comboWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/enqueueWSPort"
            binding="basicHttpBinding" bindingConfiguration="enqueueWSPortBinding"
            contract="enqueueServices.enqueueWSDelegate" name="enqueueWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/loginWSPort"
            binding="basicHttpBinding" bindingConfiguration="loginWSPortBinding"
            contract="loginServices.loginWSDelegate" name="loginWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/recordWSPort"
            binding="basicHttpBinding" bindingConfiguration="recordWSPortBinding"
            contract="recordServices.recordWSDelegate" name="recordWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/reportWSPort"
            binding="basicHttpBinding" bindingConfiguration="reportWSPortBinding"
            contract="reportServices.reportWSDelegate" name="reportWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/rtcWSPort"
            binding="basicHttpBinding" bindingConfiguration="rtcWSPortBinding"
            contract="rtcServices.rtcWSDelegate" name="rtcWSPort" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/enqueueWSPort"
            binding="basicHttpBinding" bindingConfiguration="enqueueWSPortBinding1"
            contract="enqueueServices.enqueueWSDelegate" name="enqueueWSPort1" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/loginWSPort"
            binding="basicHttpBinding" bindingConfiguration="loginWSPortBinding1"
            contract="loginServices.loginWSDelegate" name="loginWSPort1" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/recordWSPort"
            binding="basicHttpBinding" bindingConfiguration="recordWSPortBinding1"
            contract="recordServices.recordWSDelegate" name="recordWSPort1" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/reportWSPort"
            binding="basicHttpBinding" bindingConfiguration="reportWSPortBinding1"
            contract="reportServices.reportWSDelegate" name="reportWSPort1" /&gt;
        &lt;endpoint address="http://172.16.4.140:8080/APIBSWebServices/rtcWSPort"
            binding="basicHttpBinding" bindingConfiguration="rtcWSPortBinding1"
            contract="rtcServices.rtcWSDelegate" name="rtcWSPort1" /&gt;
    &lt;/client&gt;
&lt;/system.serviceModel&gt;
</code></pre>

<p></p>

<p>To access this as a client i used the following code</p>

<pre><code>        Uri loginbaseAddress = new Uri("http://172.16.4.140:8080/APIBSWebServices/loginWSPort");
        WSDualHttpBinding wsd = new WSDualHttpBinding();
        EndpointAddress ea = new EndpointAddress(loginbaseAddress, EndpointIdentity.CreateDnsIdentity("172.16.4.140"));
        //client = new CommServiceClient(new InstanceContext(this), wsd, ea);
        login_dlg = new loginWSDelegateClient(wsd, ea);

        combo_dlg = new comboWSDelegateClient();

        Uri enqueuebaseAddress = new Uri("http://172.16.4.140:8080/APIBSWebServices/enqueueWSPort");
        WSDualHttpBinding wsd1 = new WSDualHttpBinding();
        EndpointAddress ea1 = new EndpointAddress(enqueuebaseAddress, EndpointIdentity.CreateDnsIdentity("172.16.4.140"));
        enqueue_dlg = new enqueueWSDelegateClient(wsd1,ea1);

        Uri recordbaseAddress = new Uri("http://172.16.4.140:8080/APIBSWebServices/recordWSPort");
        WSDualHttpBinding wsd2 = new WSDualHttpBinding();
        EndpointAddress ea2 = new EndpointAddress(recordbaseAddress, EndpointIdentity.CreateDnsIdentity("172.16.4.140"));
        record_dlg = new recordWSDelegateClient(wsd2,ea2);

        Uri reportbaseAddress = new Uri("http://172.16.4.140:8080/APIBSWebServices/reportWSPort");
        WSDualHttpBinding wsd3 = new WSDualHttpBinding();
        EndpointAddress ea3 = new EndpointAddress(reportbaseAddress, EndpointIdentity.CreateDnsIdentity("172.16.4.140"));
        report_dlg = new reportWSDelegateClient(wsd3,ea3);

        Uri rtcbaseAddress = new Uri("http://172.16.4.140:8080/APIBSWebServices/rtcWSPort");
        WSDualHttpBinding wsd4 = new WSDualHttpBinding();
        EndpointAddress ea4 = new EndpointAddress(rtcbaseAddress, EndpointIdentity.CreateDnsIdentity("172.16.4.140"));
        rtc_dlg = new rtcWSDelegateClient(wsd4,ea4);
</code></pre>

<p>Uptil this it shows no exception and works fine. But when i call this line</p>

<p>login_dlg.login_authentication(uname, pword);</p>

<p>it gives the following exception</p>

<p>System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL <a href="http://+:80/Temporary_Listen_Addresses/5af7c44c-09d3-4078-8130-662f4d8ff804/" rel="nofollow">http://+:80/Temporary_Listen_Addresses/5af7c44c-09d3-4078-8130-662f4d8ff804/</a> because TCP port 80 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.TransportChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.DatagramChannelDemuxer<code>2.OnOuterListenerOpen(ChannelDemuxerFilter filter, IChannelListener listener, TimeSpan timeout)
   at System.ServiceModel.Channels.SingletonChannelListener</code>3.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.LayeredChannelListener<code>1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.DatagramChannelDemuxer</code>2.OnOuterListenerOpen(ChannelDemuxerFilter filter, IChannelListener listener, TimeSpan timeout)
   at System.ServiceModel.Channels.SingletonChannelListener<code>3.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.InternalDuplexChannelFactory.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory</code>1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ReliableChannelFactory<code>2.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelFactory.TypedServiceChannelFactory</code>1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ChannelFactory.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ChannelFactory.EnsureOpened()
   at System.ServiceModel.ChannelFactory<code>1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ChannelFactory</code>1.CreateChannel()
   at System.ServiceModel.ClientBase<code>1.CreateChannel()
   at System.ServiceModel.ClientBase</code>1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at APIBSClient.loginServices.loginWSDelegateClient.APIBSClient.loginServices.loginWSDelegate.login_authentication(login_authenticationRequest request) in D:\PhaseIV\FinalApp\ClientApplication_v1_1\APIBS Client\Service References\loginServices\Reference.cs:line 120
   at APIBSClient.loginServices.loginWSDelegateClient.login_authentication(String arg0, String arg1) in D:\PhaseIV\FinalApp\ClientApplication_v1_1\APIBS Client\Service References\loginServices\Reference.cs:line 128
   at APIBSClient.Classes.Database.login_sys_user(String uname, String pword) in D:\PhaseIV\FinalApp\ClientApplication_v1_1\APIBS Client\Classes\Database.cs:line 74</p>

<p>I have looked for the solution and started the Net.TCP Port Sharing Service but in vain. Can anyone tell me what is the problem and what is the solution.</p>

<p>here is the server side wsdl file</p>

<p>
http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-. -->

  
    
      
    
  
  
    
  
  
    
  
  
    
      
      
    
  
  
    
    
      
      
        
      
      
        
      
    
  
  
    
      
    
  
</p>

<p>Waiting for reply</p>
