@Html.LabelFor(m => m.SabHost)
@@ -172,4 +174,26 @@
}
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/NzbDrone/IISController.cs b/NzbDrone/IISController.cs
index 24813c620..52e1390e6 100644
--- a/NzbDrone/IISController.cs
+++ b/NzbDrone/IISController.cs
@@ -44,7 +44,8 @@ internal static Process StartServer()
IISProcess.StartInfo.CreateNoWindow = true;
- IISProcess.OutputDataReceived += (OnDataReceived);
+ IISProcess.OutputDataReceived += (OnOutputDataReceived);
+ IISProcess.ErrorDataReceived += (OnErrorDataReceived);
//Set Variables for the config file.
Environment.SetEnvironmentVariable("NZBDRONE_PATH", Config.ProjectRoot);
@@ -60,6 +61,9 @@ internal static Process StartServer()
Logger.Info("Starting process. [{0}]", IISProcess.StartInfo.FileName);
+
+
+
IISProcess.Start();
IISProcess.BeginErrorReadLine();
@@ -73,6 +77,14 @@ internal static Process StartServer()
return IISProcess;
}
+ private static void OnErrorDataReceived(object sender, DataReceivedEventArgs e)
+ {
+ if (e == null || String.IsNullOrWhiteSpace(e.Data))
+ return;
+
+ IISLogger.Error(e.Data);
+ }
+
internal static void StopServer()
{
KillProcess(IISProcess);
@@ -82,7 +94,7 @@ internal static void StopServer()
{
string processPath = process.MainModule.FileName;
Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, processPath);
- if (CleanPath(processPath) == CleanPath(IISExe))
+ if (NormalizePath(processPath) == NormalizePath(IISExe))
{
Logger.Info("[{0}]Process is considered orphaned.", process.Id);
KillProcess(process);
@@ -124,7 +136,7 @@ private static void Server(object sender, ElapsedEventArgs e)
}
}
- private static void OnDataReceived(object s, DataReceivedEventArgs e)
+ private static void OnOutputDataReceived(object s, DataReceivedEventArgs e)
{
if (e == null || String.IsNullOrWhiteSpace(e.Data) || e.Data.StartsWith("Request started:") ||
e.Data.StartsWith("Request ended:") || e.Data == ("IncrementMessages called"))
@@ -167,9 +179,19 @@ private static void KillProcess(Process process)
}
}
- private static string CleanPath(string path)
+ public static string NormalizePath(string path)
{
- return path.ToLower().Replace("\\", "").Replace("//", "//");
+ if (String.IsNullOrWhiteSpace(path))
+ throw new ArgumentException("Path can not be null or empty");
+
+ var info = new FileInfo(path);
+
+ if (info.FullName.StartsWith(@"\\")) //UNC
+ {
+ return info.FullName.TrimEnd('/', '\\', ' ');
+ }
+
+ return info.FullName.Trim('/', '\\', ' ').ToLower();
}
diff --git a/NzbDrone/NzbDrone.csproj b/NzbDrone/NzbDrone.csproj
index 983bd4931..47de312e0 100644
--- a/NzbDrone/NzbDrone.csproj
+++ b/NzbDrone/NzbDrone.csproj
@@ -13,6 +13,7 @@
v4.0
512
+
false
publish\
true
Disk
@@ -25,7 +26,6 @@
true
0
1.0.0.%2a
-
false
false
true
diff --git a/NzbDrone/Program.cs b/NzbDrone/Program.cs
index 310b0846e..eb891dd20 100644
--- a/NzbDrone/Program.cs
+++ b/NzbDrone/Program.cs
@@ -21,6 +21,7 @@ private static void Main()
AppDomain.CurrentDomain.UnhandledException += ((s, e) => AppDomainException(e));
AppDomain.CurrentDomain.ProcessExit += ProgramExited;
AppDomain.CurrentDomain.DomainUnload += ProgramExited;
+ Process.GetCurrentProcess().EnableRaisingEvents = true;
Process.GetCurrentProcess().Exited += ProgramExited;
Config.ConfigureNlog();