예제 #1
0
    static public void Main(string[] args)
    {
        EndpointAddress ep = new EndpointAddress("http://localhost:8007/HelloWCF/HelloWCFService");

        IHelloWCFService proxy = ChannelFactory <IHelloWCFService> .CreateChannel(new BasicHttpBinding(), ep);

        string s = proxy.HelloWCF();

        Console.WriteLine("output: " + s);
    }
예제 #2
0
        static void Main(string[] args)
        {
            Console.Title = "HelloWCFClientConsoleApplication";
            IHelloWCFService proxy = ChannelFactory <IHelloWCFService> .CreateChannel(
                new NetTcpBinding(),
                new EndpointAddress("net.tcp://localhost:9000/HelloWcfEndPoint"));

            for (;;)
            {
                Console.WriteLine("Enter text and hit return: ");
                string msg    = Console.ReadLine();
                string result = proxy.SayHello(msg);
                Console.WriteLine("Server returned: " + result);
            }
        }