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
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

版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网