diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-07 14:49:42 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-07 14:49:42 -0400 |
| commit | de6acec5047e54e284025a3e9749ab9afa257d45 (patch) | |
| tree | 7076a5360e7a8ea2ad8e333d1b506aa67364cf9c | |
| parent | b4bcb07c38b25d54fbf81e6abc3009cde9f80da9 (diff) | |
fixes #224 - Exception trying to start server after a reboot
| -rw-r--r-- | MediaBrowser.ServerApplication/ApplicationHost.cs | 28 |
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() |
