Beispiel #1
0
        public static int GetNetTcpPortInUse(this IWebHost host)
        {
            System.Collections.Generic.ICollection <string> addresses = host.ServerFeatures.Get <IServerAddressesFeature>().Addresses;
            var addressInUse = new Uri(addresses.First(), UriKind.Absolute);

            return(addressInUse.Port);
        }