using System; using System.Collections.Generic; using System.Linq; using System.Text;
using System.ServiceModel;//引用wcf服务 using Shexunyu.WcfServiceLibaray;//引用Wcf动态库
namespace Shexunyu.WcfServiceLibarayConServer { class Program {
static void Main(string[] args) { OpenService(); //开启服务
Console.WriteLine("Server is running. Press return to exit"); Console.ReadLine();
ClosedService(); //关闭服务
}
/// /// 服务对象 /// internal static ServiceHost myServiceHost = null;
/// /// 开启服务 /// internal static void OpenService() { Type type = typeof(Shexunyu.WcfServiceLibaray.Service1); //获得对象的类型 myServiceHost = new ServiceHost(type); //实例服务对象 myServiceHost.Open(); //打开服务 }