尝试使用ServerManager获取应用程序池时出现COMException

当我尝试使用以下代码从远程服务器获取IIS应用程序池列表时

List appPools; using (ServerManager serverManager = ServerManager.OpenRemote("XXX")) { appPools = serverManager.ApplicationPools.ToList(); } 

我得到一个例外:

 System.Runtime.InteropServices.COMException (0x800706BA): Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine XXX failed due to the following error: 800706ba. 

可能导致这种情况的任何想法?

事实certificate,可以通过在防火墙中添加适当的规则来解决问题:

  • 规则类型:入站
  • 规则类型:自定义
  • 程序:%systemroot%\ system32 \ dllhost.exe
  • 协议:TCP
  • 本地端口:RPC动态端口
  • 远程端口:所有端口
  • 动作:允许连接
  • 个人资料:域名

上述解决方案的灵感来自于此线程: Windows防火墙阻止OAB连接 。