none
WCF TCPBinding not working on another machine RRS feed

  • Question

  • Hi

    I am new to WCF and have created WCF Service and host in console and windows form client using( tcp binding )

    When I run both the service and client on same machine it work but If I move service(console host) to another machine it does not work. although I am setting below property

     // client.ClientCredentials.Windows.ClientCredential.UserName ="XXXX";
             //  client.ClientCredentials.Windows.ClientCredential.Password = "XXXXX";

    WCF Service Config ------------------------------------

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>

        <services>
          <service name="DuplexWCFService.CalculatorService">
            <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
              name="data" contract="DuplexWCFService.ICalculatorDuplex">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
              contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://172.16.35.10:8845/DuplexWCFService" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="false" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    </configuration>

    Client Web Config ----------------

                                                               

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>

            <bindings>
                <netTcpBinding>
                  <binding name="data" >


                  </binding>

                </netTcpBinding>

            </bindings>
            <client>
                <endpoint address="net.tcp://172.16.35.26:8845/DuplexWCFService"
                    binding="netTcpBinding" bindingConfiguration="data" contract="WCFServicesCal.ICalculatorDuplex"
                    name="data">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
            </client>
        </system.serviceModel>
    </configuration>

    Thursday, March 26, 2015 10:47 AM

All replies

  • Hello,

    I am moving your question to the WCF forum for better support.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Thursday, March 26, 2015 11:49 AM
  • hi 

    plz help

    Thursday, March 26, 2015 6:39 PM
  • Hi itman1981,

    >>When I run both the service and client on same machine it work but If I move service(console host) to another machine it does not work

    What error do you meet after you move your service to another machine?

    In your service config file, you have used the following address:

    <baseAddresses>
        <add baseAddress="net.tcp://172.16.35.10:8845/DuplexWCFService" />
    </baseAddresses>

    Then in your client config file, you have used the following address:

    <endpoint address="net.tcp://172.16.35.26:8845/DuplexWCFService"
                     binding="netTcpBinding" bindingConfiguration="data" contract="WCFServicesCal.ICalculatorDuplex"
                     name="data">

    The sevice and client address are different, please try to use the same endpoint address as your service endpoint.

    Besides, by default the netTcpBinding will use the Windows Authentication, please make sure that your service and client are in the same domain or a trusted domain.

    Best Regards,
    Amy Peng



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 27, 2015 6:11 AM
    Moderator
  • HI

    Thanks for response.my client is out of my domain and on different network. How can I create secure TCP wcf client and server

    please help 

    Monday, March 30, 2015 12:07 PM
  • Hi itman1981,

    Could you please try to trust client and server domains mutually? Because the default client credential type for NetTcpBinding is Windows Authentication. In order to let Windows Authentication to work both client and server must be in the same domain, or mutually trusting domains.

    If you don't have mutually trusting client and server domains, then the client and server must use some other way to determine if they trust each other with their keys. That's where certificates come in. The client and the server have their own certificates (or the server can issue the client a certificate).

    For more information, please try to refer to this thread:
    http://stackoverflow.com/questions/2536522/wcf-nettcpbinding-security-how-does-it-work .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 1, 2015 6:06 AM
    Moderator