Example #1
0
 private static void GetName()
 {
     using (ChannelFactory <PersonService.WcfService> channelFactory = new ChannelFactory <PersonService.WcfService>("WSHttpBinding_WcfService"))
     {
         PersonService.WcfService proxy = channelFactory.CreateChannel();
         using (proxy as IDisposable)
         {
             Thread.Sleep(20);
             Console.WriteLine(proxy.getName("myName by sync"));
         }
     }
 }
Example #2
0
        private async static void GetNameAsync()
        {
            using (ChannelFactory <PersonService.WcfService> channelFactory = new ChannelFactory <PersonService.WcfService>("WSHttpBinding_WcfService"))
            {
                PersonService.WcfService proxy = channelFactory.CreateChannel();
                using (proxy as IDisposable)
                {
                    Thread.Sleep(20);
                    string res = await proxy.getNameAsync("myName by async Test");

                    Console.WriteLine(res);
                }
            }
        }