C/S开发框架企业版增加WCF服务自承载实时调试后台程序
作者:C/S框架网  发布日期:2017-10-07 10:20:51
  C/S开发框架企业版增加WCF服务自承载实时调试后台程序



贴图图片



C# Code:

private static void StartService(string url, Type service)
{
   Uri baseAddresses = new Uri(url);
   
   ServiceHost host = new ServiceHost(service, baseAddresses);
   
   Binding myBinding = WCFServiceProvider.CreateBinding(BindingType.NetTcpBinding);
   host.AddServiceEndpoint(WCFServiceProvider.GetWCFInterfaceType(service), myBinding, baseAddresses);
   
   try
   {
      host.Open();
      Console.WriteLine(url);
   }
   catch (CommunicationException ex)
   {
      host.Abort();
   }
   
}

//来源:C/S框架网(www.csframework.com) QQ:23404761






贴图图片

上一篇 下一篇