Click here to Skip to main content
14,970,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have created a wcf service and hosted in my own computer . it is working fine if i consume that service in the same computer but if i try to consume that service from another computer it shows error ... configuration files of host and client is attached below ... what should i change in the configuration to consume this service from other computer in local area network



client configuration file :

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <services />
        <bindings>
            <wsHttpBinding>
                <binding name="configration" />
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://192.168.1.167:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
                binding="wsHttpBinding" bindingConfiguration="configration"
                contract="ServiceReference1.IService1" name="configration">
                <identity>
                    <dns value="192.168.1.167" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>



host configuration file :


XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="WcfServiceLibrary1.Service1Behavior"
        name="WcfServiceLibrary1.Service1">
        <endpoint address="" binding="wsHttpBinding" name="configration"
          contract="WcfServiceLibrary1.IService1">
          <identity>
            <dns value="192.168.1.167" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://*:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/" />
          </baseAddresses>
          <timeouts openTimeout="00:10:00" />
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfServiceLibrary1.Service1Behavior">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>





the error i am getting is..............

unhandled exception has occurred in your application .could not connect to http://192.168.1.99/Design_Time_Address/WcfServiceLibrary1/Service1/.Tcp error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to repond 192.168.1.99:8732
Posted
Updated 17-Sep-14 0:37am
v3
Comments
SandeepKushwah 17-Sep-14 14:38pm
   
The error is because of the Endpoint address. IP address of your host comuputer is <dns value="192.168.1.167"> that is 192.168.1.167, whereas you client is looking for the service at 192.168.1.99:8732 and hence its unable to locate. Make sure you have two computers interconnected in the same network.

1 solution

Make sure that both computers are connected in LAN and exhibit in the same IP address that is 192.168.1.(anything).
You can do one more thing... Create one more endpoint with netTCP binding and then try. Also please post the error you are getting while accessing the service on other computer.
   
Comments
Adi5555 17-Sep-14 6:38am
   
i have added the give error to my question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900