?
Solved

Consuming WCF from another machine

Posted on 2011-10-12
11
Medium Priority
?
470 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:Mortarello
  • 6
  • 5
11 Comments
 
LVL 3

Accepted Solution

by:
karl-henrik earned 2000 total points
ID: 36956208

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.
0
 

Author Comment

by:Mortarello
ID: 36956285
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
0
 

Author Comment

by:Mortarello
ID: 36956295
karl-henrik I tried to connect using Http and Works.

Tthe problem with credencial is only with net.tcp
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:karl-henrik
ID: 36956324
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.
0
 

Author Comment

by:Mortarello
ID: 36956394
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();
    }
0
 
LVL 3

Expert Comment

by:karl-henrik
ID: 36956459
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?
0
 

Author Comment

by:Mortarello
ID: 36956485
I haven't setup nothing about credential..:)
0
 
LVL 3

Expert Comment

by:karl-henrik
ID: 36956560
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
0
 
LVL 3

Expert Comment

by:karl-henrik
ID: 36956562
Note that is just an example you have to translate it to work on your system :)
0
 

Author Comment

by:Mortarello
ID: 36956579
Ok..

Thanks for that Karl-henrik.

0
 

Author Comment

by:Mortarello
ID: 36956639
Thank you very much karl-henrik.

Done...
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will show you how to add an attribute to an XML (http://en.wikipedia.org/wiki/XML) stream returned from a Windows Communication Foundation (http://en.wikipedia.org/wiki/Windows_Communication_Foundation) (WCF) Web Service.  Some knowled…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question