private static async Task BindAddressAsync(string address, AddressBindContext context)
        {
            var parsedAddress = ServerAddress.FromUrl(address);

            if (parsedAddress.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException(CoreStrings.FormatConfigureHttpsFromMethodCall($"{nameof(KestrelServerOptions)}.{nameof(KestrelServerOptions.Listen)}()"));
            }
            else if (!parsedAddress.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException(CoreStrings.FormatUnsupportedAddressScheme(address));
            }

            if (!string.IsNullOrEmpty(parsedAddress.PathBase))
            {
                throw new InvalidOperationException(CoreStrings.FormatConfigurePathBaseFromMethodCall($"{nameof(IApplicationBuilder)}.UsePathBase()"));
            }

            if (parsedAddress.IsUnixPipe)
            {
                var endPoint = new ListenOptions(parsedAddress.UnixPipePath);
                await BindEndpointAsync(endPoint, context).ConfigureAwait(false);

                context.Addresses.Add(endPoint.GetDisplayName());
            }
            else if (string.Equals(parsedAddress.Host, "localhost", StringComparison.OrdinalIgnoreCase))
            {
                // "localhost" for both IPv4 and IPv6 can't be represented as an IPEndPoint.
                await BindLocalhostAsync(parsedAddress, context).ConfigureAwait(false);
            }
            else
            {
                ListenOptions options;
                if (TryCreateIPEndPoint(parsedAddress, out var endpoint))
                {
                    options = new ListenOptions(endpoint);
                    await BindEndpointAsync(options, context).ConfigureAwait(false);
                }
                else
                {
                    // when address is 'http://hostname:port', 'http://*:port', or 'http://+:port'
                    try
                    {
                        options = new ListenOptions(new IPEndPoint(IPAddress.IPv6Any, parsedAddress.Port));
                        await BindEndpointAsync(options, context).ConfigureAwait(false);
                    }
                    catch (Exception ex) when(!(ex is IOException))
                    {
                        context.Logger.LogDebug(CoreStrings.FormatFallbackToIPv4Any(parsedAddress.Port));

                        // for machines that do not support IPv6
                        options = new ListenOptions(new IPEndPoint(IPAddress.Any, parsedAddress.Port));
                        await BindEndpointAsync(options, context).ConfigureAwait(false);
                    }
                }

                context.Addresses.Add(options.GetDisplayName());
            }
        }