Say, I have the \"Site Name\" web site in the IIS. I can access most of its functions via the ServerManager class from my C# code. What I can\'t seem to figure out is how to
JexusManager is now open source, so you can check its implementation of Binding.ToUri method,
https://github.com/jexuswebserver/Microsoft.Web.Administration/blob/master/Microsoft.Web.Administration/Binding.cs
internal string ToUri()
{
var address = EndPoint.Address.Equals(IPAddress.Any)
? Parent.Parent.Parent.Parent.HostName.ExtractName()
: EndPoint.AddressFamily == AddressFamily.InterNetwork
? EndPoint.Address.ToString()
: string.Format("[{0}]", EndPoint.Address);
return IsDefaultPort
? string.Format("{0}://{1}", Protocol, address)
: string.Format("{0}://{1}:{2}", Protocol, address, EndPoint.Port);
}
As Microsoft's MWA does not expose the HostName part, you have to replace that with something equivalent (as you are the one who initialize ServerManager, you should know what is the host name).