我在我的应用程序中使用SuperWebSocket,具有下一个配置的实例WebSocketServer
var rootConfig = new RootConfig();
var serverConfig = new ServerConfig
{
Name = $"WebSocketName_{config.Host}:3202",
Mode = SocketMode.Tcp,
Ip = config.Host,
Port = config.Port,
MaxRequestLength = 80485760, // 80Mb
MaxConnectionNumber = 200,
LogAllSocketException = true,
};
this._webSocketServer = new WebSocketServer();
this._webSocketServer.Setup(rootConfig, serverConfig, logFactory: new Log4Net2NLogFactory());
然而,在重新启动程序后,我发现了一个异常:
错误异常:' System.Net.Sockets.SocketException(0x80004005)
如何在关闭我的应用程序时正确关闭Web套接字服务器。
P.S。终结器代码
this._webSocketServer?.Dispose();