DirectoryEntry 使用哪些端口?
我的目标是从远程服务器获取网站名称列表。但我得到了例外:
RPC 服务器不可用。
这是代码:
public List<string> GetWebSites(string serverIP)
{
List<string> names = new List<string>();
DirectoryEntry Services = new DirectoryEntry(string.Format("IIS://{0}/W3SVC", serverIP));
Services.Username = "user name";
Services.Password = "password";
IEnumerator ie = Services.Children.GetEnumerator();
DirectoryEntry Server = null;
while (ie.MoveNext())
{
Server = (DirectoryEntry)ie.Current;
if (Server.SchemaClassName == "IIsWebServer")
{
names.Add(Server.Properties["ServerComment"][0].ToString());
}
}
return names;
}
当计算机上的防火墙关闭时,这可以正常工作。
我需要知道的是,DirectoryEntry 使用了哪些端口? 或者有没有其他方法可以在不关闭防火墙的情况下获取网站名称?
My goal is to get the list of web site names from remote server. But I'm getting the exception:
The RPC server is unavailable.
Here is the code:
public List<string> GetWebSites(string serverIP)
{
List<string> names = new List<string>();
DirectoryEntry Services = new DirectoryEntry(string.Format("IIS://{0}/W3SVC", serverIP));
Services.Username = "user name";
Services.Password = "password";
IEnumerator ie = Services.Children.GetEnumerator();
DirectoryEntry Server = null;
while (ie.MoveNext())
{
Server = (DirectoryEntry)ie.Current;
if (Server.SchemaClassName == "IIsWebServer")
{
names.Add(Server.Properties["ServerComment"][0].ToString());
}
}
return names;
}
this works fine, when firewall is turned off on the machine.
What I need to know is, which port(s) are used by DirectoryEntry?
or is there any other way to get web site names, without turning off firewall?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信 LDAP 协议使用 TCP 不是吗?对于非 ssl 应为端口 389,对于 SSL 应为 636
I believe LDAP protocol uses TCP no? Should be port 389 for non-ssl and 636 for SSL