The Free Software Media System - Server Backend & API
fixes #224 - Exception trying to start server after a reboot
Luke Pulverentide6acec5047e
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.csindex 07e615b1da..309a2c3518 100644--- a/MediaBrowser.ServerApplication/ApplicationHost.cs+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs@@ -382,7 +382,8 @@ namespace MediaBrowser.ServerApplicationHttpServer.Init(GetExports<IRestfulService>(false));ServerManager.AddWebSocketListeners(GetExports<IWebSocketListener>(false));- ServerManager.Start();++ StartServer(true);},() => LibraryManager.AddParts(GetExports<IResolverIgnoreRule>(), GetExports<IVirtualFolderCreator>(), GetExports<IItemResolver>(), GetExports<IIntroProvider>(), GetExports<IBaseItemComparer>()),@@ -405,6 +406,31 @@ namespace MediaBrowser.ServerApplication);}+ /// <summary>+ /// Starts the server.+ /// </summary>+ /// <param name="retryOnFailure">if set to <c>true</c> [retry on failure].</param>+ private void StartServer(bool retryOnFailure)+ {+ try+ {+ ServerManager.Start();+ }+ catch+ {+ if (retryOnFailure)+ {+ RegisterServerWithAdministratorAccess();++ StartServer(false);+ }+ else+ {+ throw;+ }+ }+ }+/// <summary>/// Restarts this instance./// </summary>