@ -615,12 +615,35 @@ namespace Emby.Server.Implementations
var host = new WebHostBuilder ( )
. UseKestrel ( options = >
{
var addresses = ServerConfigurationManager
. Configuration
. LocalNetworkAddresses
. Select ( NormalizeConfiguredLocalAddress )
. Where ( i = > i ! = null )
. ToList ( ) ;
if ( addresses . Any ( ) )
{
foreach ( var address in addresses )
{
Logger . LogInformation ( "Kestrel listening on {ipaddr}" , address ) ;
options . Listen ( address , HttpPort ) ;
if ( EnableHttps & & Certificate ! = null )
{
options . Listen ( address , HttpsPort , listenOptions = > listenOptions . UseHttps ( Certificate ) ) ;
}
}
}
else
{
Logger . LogInformation ( "Kestrel listening on all interfaces" ) ;
options . ListenAnyIP ( HttpPort ) ;
if ( EnableHttps & & Certificate ! = null )
{
options . ListenAnyIP ( HttpsPort , listenOptions = > listenOptions . UseHttps ( Certificate ) ) ;
}
}
} )
. UseContentRoot ( contentRoot )
. ConfigureServices ( services = >
@ -640,8 +663,16 @@ namespace Emby.Server.Implementations
} )
. Build ( ) ;
try
{
await host . StartAsync ( ) . ConfigureAwait ( false ) ;
}
catch ( Exception ex )
{
Logger . LogError ( "Kestrel failed to start! This is most likely due to an invalid address or port bind - correct your bind configuration in system.xml and try again." ) ;
throw ;
}
}
private async Task ExecuteWebsocketHandlerAsync ( HttpContext context , Func < Task > next )
{