which port(s) are used by DirectoryEntry?

北战南征 提交于 2019-12-24 02:06:24

问题


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?


回答1:


I believe LDAP protocol uses TCP no? Should be port 389 for non-ssl and 636 for SSL



来源:https://stackoverflow.com/questions/8563485/which-ports-are-used-by-directoryentry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!