• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

Consuming WCF from another machine


I'm try to consume my wcf hosted in console app from another machine and I'm getting erro
No connection could be made because the target machine actively refused it

Does any one could help me ?

My firewall is already disabled. If i try to create a client on same machine work, but from another machine doen'st work.

Tks guys
  • 6
  • 5
1 Solution

You are trying to connect to your own machine the error message is refering you to localhost (your own internal ip).

Make sure you have the correct IP to the other machine.
MortarelloAuthor Commented:
Hi karl-henrik,

Tks for your answer. Wow this is funny cos when i added the reference I typed http://machinename:8082/SFinancial and on App.conf has been created with localhost.
I changed now and he gave me another erro :

The server has rejected the client credentials.

Could you help me with that karl-henrik ?

Tks Man
MortarelloAuthor Commented:
karl-henrik I tried to connect using Http and Works.

Tthe problem with credencial is only with net.tcp
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

If you look at IIS you have different credentials for running your WCF service.. the simplest I would assume for you is to set  anonymous (Under the Authentication tab) in IIS that might work.

If you share some code and configurations I might be able to help you further :)

This link might shed some light on how to set up the WCF permissions too..

Hope it helps
MortarelloAuthor Commented:
Hi karl-henrik,

Sure, i will post it now..There is nothing fancing cos I'm learning wcf. I'm hosting on Console App

<?xml version="1.0" encoding="utf-8" ?>
                <binding name="Default_http" transferMode="Streamed">
                    <security mode="None" />
                <behavior name="Default">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <serviceThrottling />
            <service behaviorConfiguration="Default" name="WcfServiceLibrary1.SFinancial">
                <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="Default_http"
                    contract="WcfServiceLibrary1.IFinancial" />
                <endpoint address="nettcp" binding="netTcpBinding" contract="WcfServiceLibrary1.IFinancial" />
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <endpoint address="mexTcp" binding="mexTcpBinding" contract="IMetadataExchange" />
                        <add baseAddress="http://localhost:8090/SFinancial" />
                        <add baseAddress="https://localhost:8091/SFinancial" />
                        <add baseAddress="net.tcp://localhost:8092/SFinancial" />
    public interface IFinancial
        int Getvalue(int arg);

        void dooSomeThing();
 [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class SFinancial : IFinancial
        public int Getvalue(int arg)
            return arg++;

        public void dooSomeThing()

        public void dooSomeThingToo()
            Console.WriteLine("You call me..");
            Console.WriteLine("done Too..");

        void dooSomeThingToo();
Can't find any errors there but I am not the best at configurationg WCF but I do belive that netTCP does not support the streaming transfermode but don't take my word for it because I could not find any references to back that information up..

What client credentials did you set up in your WCF project?
MortarelloAuthor Commented:
I haven't setup nothing about credential..:)
Oh :) this is slightly "out of the blue" (but it should work - did not have a chance to test it)

  <binding name="WSHttpBinding_IService”>
    <security mode="Message">
      <transport clientCredentialType="None"  
                 proxyCredentialType="None" realm="" />
      <message clientCredentialType="None"/>  

You can read more about it here
Note that is just an example you have to translate it to work on your system :)
MortarelloAuthor Commented:

Thanks for that Karl-henrik.

MortarelloAuthor Commented:
Thank you very much karl-henrik.

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.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now