WCF/WF - How to call the service method from the Self hosted WCF

Asked By MySpider DotNet on 18-Nov-10 01:55 AM
Hi,

  I created a self hosting in my console application, When i can able to start the service but am unable to cunsume the Service method. My Code is as below

In my Console application i created a instance and host the service as below

using (ServiceHost consoleHost = new
        ServiceHost(typeof(WCFService1)))
        {
          consoleHost.Open();

          Console.WriteLine("press any key to stop service host...");
          Console.ReadLine();

          Console.ReadLine();
          consoleHost.Close();
          Console.WriteLine("Service Stoped");
          Console.ReadLine();
        }

My Service method is as below
public class WCFService1 : IWCFService1
    {
      public string DoWork()
      {
        return "Hello from WCF Service";
      }
    }
 Now i want to call this DoWork() method in my console application how can i call this method

Mitesh Darji replied to MySpider DotNet on 18-Nov-10 03:52 AM
can you please go through this link:, In this link you will get the information about Hosting and consuming WCF Services

http://msdn.microsoft.com/en-us/library/bb332338.aspx