C/S开发框架企业版增加WCF服务自承载实时调试后台程序
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();
}
}