110,534
社区成员
发帖
与我相关
我的任务
分享
ServiceHost host = new ServiceHost(typeof(服务名称));
if (host.State != CommunicationState.Opening)
{
host.Open();//开启服务
}
if (host != null)
{
if (host.State == CommunicationState.Opened)
{
host.Close();//关闭服务
}
}