背景
supersocket使用的是 版本2
工程使用的是wpf
报错信息
Microsoft.Hosting.Lifetime: Information: Waiting for the host to be disposed. Ensure all 'IHost' instances are wrapped in 'using' blocks.
根据报错信息得到,需要将IHost 进行释放.不然程序无法顺利退出。
解决方案
App 类中重写 OnExit,调用 IHost 中的 Dispose函数!
protected override void OnExit(ExitEventArgs e)
{
TcpSvrCtrl.Instance._host.StopAsync().Wait();
TcpSvrCtrl.Instance._host.Dispose();
base.OnExit(e);
}