问题
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