且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ManagementClass.InvokeMethod在重新启动目标计算机后抛出异常

更新时间:2023-01-30 09:29:33

一些理论。

1 )当你调用它时,远程服务器没有准备就绪,因此它没有通过调用。

1) The remote server isn't ready when you call it so it fails the call.

2)由于性能原因,你(或你所依赖的代码)正在缓存远程连接对象当目标机器离开时,连接对象不知道。当你再次尝试使用它时,连接对象被使用但由于
远程连接消失而失败。你得到一个异常并且连接被删除再次尝试建立一个新连接。

2) You (or code you're relying on) is caching the remote connection object for performance reasons. When the target machine goes away the connection object doesn't know that. When you try to use it again the connection object is used but fails because the remote connection was gone. You get an exception and the connection is dropped. Trying again establishes a new connection.

这也是ADO.NET连接对象的常见问题,因为它们也是这样做的。

This is a very common problem with ADO.NET connection objects as they do this as well.