Fixed problem with Uninstaller and Shutdown handling of Diagnostic service.

This commit is contained in:
Eric Fontana
2014-10-01 07:47:51 -04:00
parent e02624a8b0
commit d25b62823c
4 changed files with 38 additions and 17 deletions

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.3.0")]

View File

@@ -43,10 +43,12 @@ namespace TimberWinR.Diagnostics
private void DiagnosticCallback(IAsyncResult result)
{
if (web == null)
return;
var context = web.EndGetContext(result);
var response = context.Response;
JObject json = new JObject(
new JProperty("timberwinr",
new JObject(
@@ -80,16 +82,20 @@ namespace TimberWinR.Diagnostics
private void HttpListen(object o)
{
web = new HttpListener();
try
{
web.Prefixes.Add(string.Format("http://*:{0}/", Port));
web.Start();
while (web.IsListening)
while (web != null && web.IsListening)
{
processRequest();
}
web.Stop();
}
catch (Exception ex)
{
LogManager.GetCurrentClassLogger().Error("Diagnostic Listener Error: {0}", ex.ToString());
}
}
private void ListenForClients(object olistener)
@@ -169,6 +175,19 @@ namespace TimberWinR.Diagnostics
public void Shutdown()
{
try
{
if (web != null && web.IsListening)
{
LogManager.GetCurrentClassLogger().Info("Shutting down diagnostics listener");
web.Close();
web = null;
}
}
catch (Exception ex)
{
LogManager.GetCurrentClassLogger().Error(ex);
}
}
}

View File

@@ -91,6 +91,8 @@ namespace TimberWinR
LogManager.GlobalThreshold = LogLevel.FromString(logLevel);
LogManager.GetCurrentClassLogger()
.Info("TimberWinR Version {0}", GetAssemblyByName("TimberWinR.ServiceHost").GetName().Version.ToString());
// Is it a directory?
if (Directory.Exists(jsonConfigFile))

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="86CA5678-4687-4352-99EB-783CDB7C8D82" Name="TimberWinR" Language="1033" Version="$(var.VersionNumber)" Manufacturer="Vistaprint" UpgradeCode="5c2b6a95-34d5-4131-8fb0-5c97214df942">
<Product Id="*" Name="TimberWinR" Language="1033" Version="$(var.VersionNumber)" Manufacturer="Vistaprint" UpgradeCode="5c2b6a95-34d5-4131-8fb0-5c97214df942">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Property Id="CONFIGFILE">default.json</Property>
<Property Id="LOGDIR">c:\logs</Property>