2

Found this which may explain some of my problems - MSDN Post

I have written a wcf service hosted inside a console application. I then have a client that interacts with the service.

The client and service work fine on my machine.

When I move the client to another computer, I can get it working but I have to turn the firewall off on both the server and client machine ( im assuming I can fix this just by opening the firewall ports that the service eventually need to communicate with?) but I also have to turn skype off otherwise I get an "could not register URL http://+:80/temporary_Listen_Address/......" "the process could not access the file because it is being used by another process".

I have read some stuff about changing the client base address but could not get this operating. I may however be missing something else. I have a feeling I should be changing the endpoint address in teh client config when I move it to a different machine to my own, but this broke the setup so I left it unchanged.

Here are my configs.

Server

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsDualHttpBinding>
        <binding name="WSDualHttpBinding_IDataCollector" 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="UserName" />
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <services>
      <service name="DataCollector" behaviorConfiguration="defaultProfile" >
        <endpoint address="http://192.168.1.74:8080" binding="wsDualHttpBinding"
          bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="IDataCollector"  />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="defaultProfile">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceCredentials>
            <serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ConsoleHost.UsernameValidator, ConsoleHost" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

Client

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IDataCollector" 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="UserName" />
                    </security>
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://192.168.1.74:8080/" binding="wsDualHttpBinding"
                bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="AshService.IDataCollector"
                name="WSDualHttpBinding_IDataCollector" behaviorConfiguration="myClientBehavior">
              <identity>
                    <certificate encodedValue="AwAAAAEAAAAUAAAA9fenyF3cSS38ldDDxtUyC8TajBAgAAAAAQAAALgBAAAwggG0MIIBYqADAgECAhD3kPMzVBbXlEAT5S65MldSMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTEwMjExMTU0MDMwWhcNMzkxMjMxMjM1OTU5WjAXMRUwEwYDVQQDEwxNeVNlcnZlckNlcnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ9D8W2GBGvwTAZ2eQj12atxPruZxuOwTCLXRwtEvpnoLmlwBuxo7Wb+of0k4XTNLa7q/Xvjh3zsJbvevlPG3hk9+ugds/Je5X69uPbQApYJO2HZNY9hrwfMZ40iaJ54vVAkdnIhDT5pEpmKVFFkPangk1aMyb6Ilm4NjO9bUxjFAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAGT7q1aZwAaJ4sMbv53BOo2/yVSpYkTRIaQwT0uYdY1SLyJ7uaUwqJR0jG+nNqwgyOEOfg4Tz0/dX740dw12+1Q==" />
                </identity>
            </endpoint>
        </client>
      <behaviors>
        <endpointBehaviors>
          <behavior name="myClientBehavior">
            <clientCredentials>
              <serviceCertificate>
                <authentication certificateValidationMode="Custom" customCertificateValidatorType="ConsoleClient.MyX509Validator,ConsoleClient" />
              </serviceCertificate>
            </clientCredentials>
          </behavior>
        </endpointBehaviors>
      </behaviors>
    </system.serviceModel>
</configuration>

Kind Regards

Ash

user589195
  • 4,180
  • 13
  • 53
  • 81

3 Answers3

4

In the client application configuration, edit the binding to include clientBaseAddress attribute.

Below is the sample clients' binding configuration

 <bindings>
   <wsDualHttpBinding>
    <binding name="wsDualHttpBinding.TimeService" closeTimeout="00:01:00"
        clientBaseAddress="http://localhost:9090/WCF.ServiceClient.TimeService/">
    </binding> 
   </wsDualHttpBinding>
</bindings> 
Vijay Sirigiri
  • 4,653
  • 29
  • 31
  • Thanks Vijay, Managed to get it working. Am I right in thinking the client base address is the address the client will host its own "callback service"? – user589195 Feb 14 '11 at 11:17
  • 1
    Yes. If clientBaseAddress is not specified, the port default to 80 which would fail if you have IIS or any other app using port 80 already. – Vijay Sirigiri Feb 14 '11 at 11:28
3

Skype has settings to disable the usage of port 80, check skype options. So skype and your service can co-exist and work!

https://support.skype.com/en-us/faq/FA528/Conflicts-with-applications-such-as-Apache-or-IIS-working-on-port-80-443

Numan
  • 3,918
  • 4
  • 27
  • 44
  • Thanks for this. I'll look into it. Any ideas why it was working fine on my computer then not on a different client? Differing skype settings? – user589195 Feb 14 '11 at 10:11
1

Your endpoint address must match machine/port/protocol of the server. Your endpoint in the example hits port 8080.

mmix
  • 6,057
  • 3
  • 39
  • 65
  • I'm still a wcf beginner so what I say may be incorrect but... I have set the main communcation to happen on port 8080. I believe the conflict is on the callback. From what I've read if you dont specify a port for callback to use then its run on port 80, hence the skype problems. If someone could show me how to change the callback port used that would be great. – user589195 Feb 14 '11 at 10:10
  • Google is your friend http://mleder.blogspot.com/2007/06/wcf-callback-port-for-wsdualhttpbinding.html – mmix Feb 14 '11 at 10:16