how to configure different port and service URL and clientBaseAddress ?

Hi,

I have a WCF Service (using WSDualHttpBinding) hosted on a machine. I am try to consume service from a different machine.

In the app.config i have added endpoint address as http://pc1/ServiceTest/Service1.svc  and clientBaseAddress as http://pc1/ServiceTest/Service1.svc

I am getting error while consuming service as metioned below :

Message: HTTP could not register URL http://+:80/ServiceTest/Service1.svc/ because TCP port 80 is being used by another application.
SanjaySutarAsked:
Who is Participating?
 
UnfluxCommented:
I assume that you have provided a port number in your service host endpoint address such as:

http://localhost:8080/WSDualHttpBindingTest/Service.svc

Assuming this is the case you need to specifiy that exact address in your client endpoint address configuration:

  <client>
		<endpoint
			address="http://pc1:8080/WSDualHttpBindingTest/Service1.svc"
			binding="wsDualHttpBinding"
			contract="ServiceReference1.ServerService"
			bindingConfiguration="ServerService"
			name="ServerService" />
  </client> 

Open in new window

0
 
UnfluxCommented:
You are receiving the provided message because you are attempting to register your server on port 80, which your local machine is currently using, and therefore has already registered, for use with web http requests.

To resolve this error simply specify a port number within your base address, for example:

<system.serviceModel>
	<services>
		<service name="MyNamespace.MyService">
			<clear />
			<endpoint
				address="dual"
				binding="WSDualHttpBinding"
				contract="MyNamespace.IMyService"
				/>
				<!-- 
					add other service endpoints with desired attributes as required
				-->
			<host>
				<baseAddresses>
					<add baseArress="http://pc1:8080/myservice" />
				</baseAddresses>
			</host>
		</service>
		<!--
			add other services as required
		-->
	</services>
</system.serviceModel>

Open in new window

0
 
SanjaySutarAuthor Commented:
Hi Unflux, thanx for the reply.

If WCF service and consuming application are on the same machine then adding port no. to clientBaseAddress is working.

But in this case my WCF service is hosted on some different machine.

So i am getting the error. Please take a look at the config file and correct me if am making any mistake.

I also tried to use different ports in service URL available on WCF service host machine, but all in vain.

<bindings>
      <wsDualHttpBinding>
        <binding name="ServerService" closeTimeout="00:30:00"
            openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" clientBaseAddress="http://pc1:1123/WSDualHttpBindingTest/Service1.svc">
          <readerQuotas maxDepth="32" maxStringContentLength="131072000" maxArrayLength="16384"
              maxBytesPerRead="51200" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:30:00" />
          
          <security mode="Message">
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default" />
          </security>
         
        </binding>
        
      </wsDualHttpBinding>
    </bindings>

<client>
      <endpoint address="http://pc1/WSDualHttpBindingTest/Service1.svc" binding="wsDualHttpBinding"
          bindingConfiguration="ServerService"
          contract="ServiceReference1.ServerService" name="ServerService">
              </endpoint>
    </client>

Open in new window

0
 
SanjaySutarAuthor Commented:
I have that already in config files.

Server Config

<endpoint address="http://localhost:2660/Service1.svc" binding="wsDualHttpBinding" contract="WSDualHttpBindingTest.IServerService" />

Open in new window



Client Config

<client>
      <endpoint address="http://localhost:2660/Service1.svc" />

Open in new window


<bindings>
      <wsDualHttpBinding>
        <binding name="ServerService" clientBaseAddress="http://localhost:8080/Service1.svc" />

Open in new window



Still I am getting error as i have mentioned earlier.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.