@ -224,7 +224,7 @@ namespace MediaBrowser.Server.Startup.Common
private readonly StartupOptions _startupOptions ;
private readonly StartupOptions _startupOptions ;
private readonly string _remotePackageName ;
private readonly string _remotePackageName ;
private readonly bool _supportsNativeWebSocket ;
private bool _supportsNativeWebSocket ;
internal INativeApp NativeApp { get ; set ; }
internal INativeApp NativeApp { get ; set ; }
@ -454,6 +454,18 @@ namespace MediaBrowser.Server.Startup.Common
RegisterSingleInstance < ISearchEngine > ( ( ) = > new SearchEngine ( LogManager , LibraryManager , UserManager ) ) ;
RegisterSingleInstance < ISearchEngine > ( ( ) = > new SearchEngine ( LogManager , LibraryManager , UserManager ) ) ;
if ( IsFirstRun )
{
ServerConfigurationManager . Configuration . EnableWin8HttpListener = false ;
ServerConfigurationManager . SaveConfiguration ( ) ;
_supportsNativeWebSocket = false ;
}
if ( ! ServerConfigurationManager . Configuration . EnableWin8HttpListener )
{
_supportsNativeWebSocket = false ;
}
HttpServer = ServerFactory . CreateServer ( this , LogManager , "Media Browser" , WebApplicationName , "dashboard/index.html" , _supportsNativeWebSocket ) ;
HttpServer = ServerFactory . CreateServer ( this , LogManager , "Media Browser" , WebApplicationName , "dashboard/index.html" , _supportsNativeWebSocket ) ;
RegisterSingleInstance ( HttpServer , false ) ;
RegisterSingleInstance ( HttpServer , false ) ;
progress . Report ( 10 ) ;
progress . Report ( 10 ) ;
@ -470,7 +482,7 @@ namespace MediaBrowser.Server.Startup.Common
ImageProcessor = new ImageProcessor ( LogManager . GetLogger ( "ImageProcessor" ) , ServerConfigurationManager . ApplicationPaths , FileSystemManager , JsonSerializer , MediaEncoder ) ;
ImageProcessor = new ImageProcessor ( LogManager . GetLogger ( "ImageProcessor" ) , ServerConfigurationManager . ApplicationPaths , FileSystemManager , JsonSerializer , MediaEncoder ) ;
RegisterSingleInstance ( ImageProcessor ) ;
RegisterSingleInstance ( ImageProcessor ) ;
SyncManager = new SyncManager ( LibraryManager , SyncRepository , ImageProcessor , LogManager . GetLogger ( "SyncManager" ) , UserManager , DtoService , this ) ;
SyncManager = new SyncManager ( LibraryManager , SyncRepository , ImageProcessor , LogManager . GetLogger ( "SyncManager" ) , UserManager , ( ) = > DtoService , this ) ;
RegisterSingleInstance ( SyncManager ) ;
RegisterSingleInstance ( SyncManager ) ;
DtoService = new DtoService ( Logger , LibraryManager , UserDataManager , ItemRepository , ImageProcessor , ServerConfigurationManager , FileSystemManager , ProviderManager , ( ) = > ChannelManager , SyncManager , this ) ;
DtoService = new DtoService ( Logger , LibraryManager , UserDataManager , ItemRepository , ImageProcessor , ServerConfigurationManager , FileSystemManager , ProviderManager , ( ) = > ChannelManager , SyncManager , this ) ;
@ -735,7 +747,7 @@ namespace MediaBrowser.Server.Startup.Common
ServerManager . AddWebSocketListeners ( GetExports < IWebSocketListener > ( false ) ) ;
ServerManager . AddWebSocketListeners ( GetExports < IWebSocketListener > ( false ) ) ;
StartServer ( true ) ;
StartServer ( ) ;
LibraryManager . AddParts ( GetExports < IResolverIgnoreRule > ( ) ,
LibraryManager . AddParts ( GetExports < IResolverIgnoreRule > ( ) ,
GetExports < IVirtualFolderCreator > ( ) ,
GetExports < IVirtualFolderCreator > ( ) ,
@ -773,8 +785,7 @@ namespace MediaBrowser.Server.Startup.Common
/// <summary>
/// <summary>
/// Starts the server.
/// Starts the server.
/// </summary>
/// </summary>
/// <param name="retryOnFailure">if set to <c>true</c> [retry on failure].</param>
private void StartServer ( )
private void StartServer ( bool retryOnFailure )
{
{
try
try
{
{
@ -784,18 +795,9 @@ namespace MediaBrowser.Server.Startup.Common
{
{
Logger . ErrorException ( "Error starting http server" , ex ) ;
Logger . ErrorException ( "Error starting http server" , ex ) ;
if ( retryOnFailure )
{
RegisterServerWithAdministratorAccess ( ) ;
StartServer ( false ) ;
}
else
{
throw ;
throw ;
}
}
}
}
}
/// <summary>
/// <summary>
/// Called when [configuration updated].
/// Called when [configuration updated].
@ -1070,9 +1072,8 @@ namespace MediaBrowser.Server.Startup.Common
try
try
{
{
NativeApp . AuthorizeServer (
NativeApp . AuthorizeServer (
ServerConfigurationManager . Configuration . HttpServerPortNumber ,
HttpServerUrlPrefixes . First ( ) ,
UdpServerEntryPoint . PortNumber ,
UdpServerEntryPoint . PortNumber ,
ServerConfigurationManager . Configuration . HttpServerPortNumber ,
ConfigurationManager . CommonApplicationPaths . TempDirectory ) ;
ConfigurationManager . CommonApplicationPaths . TempDirectory ) ;
}
}
catch ( Exception ex )
catch ( Exception ex )