aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs28
1 files changed, 27 insertions, 1 deletions
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index 07e615b1d..309a2c351 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -382,7 +382,8 @@ namespace MediaBrowser.ServerApplication
HttpServer.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>()),
@@ -406,6 +407,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>
public override void Restart()