Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用托管服务 (IHostedService) 来保持连接始终打开,以避免连接开销。
(例如,仅在 StartAsync 方法调用 FtpClient.Connect,在 StopAsync 调用 FtpClient.Disconnect)。
并且 FTP 操作在应用程序生命周期中在同一个连接中完成。
如果 FTP 服务器断开连接或关闭,是否会触发任何事件?因此,我可以尝试定期重新连接以恢复连接。