What port is DirectoryEntry using?

My goal is to get a list of website names from a remote server. But I get an 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 great when the firewall is off on the machine.

What do I need to know which port is used by DirectoryEntry? or is there another way to get website names without disabling the firewall?

+2
source share
1 answer

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

+2
source

Source: https://habr.com/ru/post/1265993/


All Articles