mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
More work on WindowsService, still broken
This commit is contained in:
parent
6b7923bd52
commit
6f3065d5ab
13 changed files with 289 additions and 183 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
|
@ -7,7 +8,7 @@ using NzbDrone.Providers;
|
|||
|
||||
namespace NzbDrone
|
||||
{
|
||||
public class ApplicationServer
|
||||
public class ApplicationServer : ServiceBase
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetLogger("Host.App");
|
||||
|
||||
|
@ -18,6 +19,13 @@ namespace NzbDrone
|
|||
private readonly ProcessProvider _processProvider;
|
||||
private readonly WebClient _webClient;
|
||||
|
||||
public void IsRunningAsService()
|
||||
{
|
||||
Logger.Warn(base.Container);
|
||||
Logger.Warn(base.ServiceName);
|
||||
|
||||
}
|
||||
|
||||
[Inject]
|
||||
public ApplicationServer(ConfigProvider configProvider, WebClient webClient, IISProvider iisProvider,
|
||||
DebuggerProvider debuggerProvider, EnviromentProvider enviromentProvider,
|
||||
|
@ -33,6 +41,13 @@ namespace NzbDrone
|
|||
|
||||
public ApplicationServer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void StartService()
|
||||
{
|
||||
Start();
|
||||
Run(this);
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
|
@ -67,7 +82,12 @@ namespace NzbDrone
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void Stop()
|
||||
protected override void OnStop()
|
||||
{
|
||||
StopServer();
|
||||
}
|
||||
|
||||
public void StopServer()
|
||||
{
|
||||
Logger.Info("Attempting to stop application.");
|
||||
_iisProvider.StopServer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue