Link to home
Start Free TrialLog in
Avatar of Mortarello
MortarelloFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Consuming WCF from another machine

Guys,

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 127.0.0.1:8092.

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
ASKER CERTIFIED SOLUTION
Avatar of karl-henrik
karl-henrik
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mortarello

ASKER

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
karl-henrik I tried to connect using Http and Works.

Tthe problem with credencial is only with net.tcp
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
//Karl.
Hi karl-henrik,

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

App.config
---------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Default_http" transferMode="Streamed">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <behaviors>
            <serviceBehaviors>
                <behavior name="Default">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <serviceThrottling />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <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" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8090/SFinancial" />
                        <add baseAddress="https://localhost:8091/SFinancial" />
                        <add baseAddress="net.tcp://localhost:8092/SFinancial" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>
--------------------------------------------
 [ServiceContract]
    public interface IFinancial
    {
        [OperationContract]
        int Getvalue(int arg);

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

        public void dooSomeThing()
        {
            Thread.Sleep(10000);
            Console.WriteLine("done..");
        }

        public void dooSomeThingToo()
        {
            Thread.Sleep(2000);
            Console.WriteLine("You call me..");
            Thread.Sleep(10000);
            Console.WriteLine("done Too..");
        }
    }



        [OperationContract]
        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?
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)

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

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

Thanks for that Karl-henrik.

Thank you very much karl-henrik.

Done...