fixes #224 - Exception trying to start server after a reboot

pull/702/head
Luke Pulverenti 12 years ago
parent b4bcb07c38
commit de6acec504

@ -382,7 +382,8 @@ namespace MediaBrowser.ServerApplication
HttpServer.Init(GetExports<IRestfulService>(false)); HttpServer.Init(GetExports<IRestfulService>(false));
ServerManager.AddWebSocketListeners(GetExports<IWebSocketListener>(false)); ServerManager.AddWebSocketListeners(GetExports<IWebSocketListener>(false));
ServerManager.Start();
StartServer(true);
}, },
() => LibraryManager.AddParts(GetExports<IResolverIgnoreRule>(), GetExports<IVirtualFolderCreator>(), GetExports<IItemResolver>(), GetExports<IIntroProvider>(), GetExports<IBaseItemComparer>()), () => 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> /// <summary>
/// Restarts this instance. /// Restarts this instance.
/// </summary> /// </summary>

Loading…
Cancel
Save