WCF入门-项目间调用服务

练习WCF入库,添加了一个WCF项目,同时添加了一个控制台程序,在控制台程序启动时,调用WCF服务,报错。

控制台程序代码为:

namespace WcfConsumer
{
    class Program
    {
        static void Main(string[] args)
        {
            using (ServiceHost serviceHost = new ServiceHost(typeof(testService))) { 
                serviceHost.Open(); 
                Console.WriteLine("WCF Service has started..."); 
                Console.ReadLine(); 
                serviceHost.Close(); 
            } 
            Console.WriteLine("The WCF Service has stopped..."); 
        }
    }
}

  

 

posted @ 2016-11-30 15:59  善恒  阅读(320)  评论(1编辑  收藏  举报