/// <summary> /// 停止监听器 /// </summary> public int Stop() { int result = 1; try { if (BaseListener != null) { BaseListener.Stop(); BaseListener = null; } _raiser.Stop(); ServiceStateChanged?.BeginInvoke(this, new ServiceStateEventArgs($"HTTP监听服务{Name}已停止", ServiceState.Stopped), null, null); } catch (ObjectDisposedException e) { LastErrorMessage = $"HTTP监听服务{Name}已被释放:{e.Message}"; result = 0; BaseListener = null; } catch (Exception e) { LastErrorMessage = $"HTTP监听服务{Name}停止过程中出现错误:{e.Message}"; result = 0; throw; } return(result); }
public void Stop() { //Logging.info($"stopping listening on {BaseListener.LocalEndpoint}"); stopping = true; BaseListener.Stop(); }