尝试使用ServerManager获取应用程序池时出现COMException
问题描述:
当我尝试使用以下代码从远程服务器获取IIS应用程序池列表时
When I try to get the list of IIS application pools from a remote server using the following code
List<ApplicationPool> 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.
任何想法可能是什么原因造成的?
Any ideas what might be causing this?
答
结果可以通过在防火墙中添加适当的规则来解决该问题:
Turns out the problem can be fixed by adding an appropriate rule in the Firewall:
- 规则类型:入站
- 规则类型:自定义
- 程序:%systemroot%\ system32 \ dllhost.exe
- 协议:TCP
- 本地端口:RPC动态端口
- 远程端口:所有端口
- 操作:允许连接
- 个人资料:域
The above solution was inspired by this thread: Windows Firewall blocking OAB connections.