removed hardcoded string for WebApp endpoint (previously "http://*:8800")
The app now pulls in the port from the app.config file. Also added some commented out code to load a config file in a different directory (i.e.: to allow config files in "configs" directory to be pulled in). If the port isnt specified in the app.config, will default to 8800. #27
This commit is contained in:
parent
f21088d0a0
commit
b20a506d3a
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using CardReaderService.DefaultComponents;
|
using CardReaderService.DefaultComponents;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||||
<add key="DefaultPageSize" value="20" />
|
<add key="DefaultPageSize" value="20" />
|
||||||
|
<add key="WebsiteHttpPort" value="8800"/>
|
||||||
<add key="SwipeTimeGap" value="3" />
|
<add key="SwipeTimeGap" value="3" />
|
||||||
<add key="BugSubmissionEmailAddress" value="incoming+WattsC/FlexiTimeTrackerTool+24qrefn8e1urhl4iqct7we2jl@gitlab.com"/>
|
<add key="BugSubmissionEmailAddress" value="incoming+WattsC/FlexiTimeTrackerTool+24qrefn8e1urhl4iqct7we2jl@gitlab.com"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Interfaces;
|
using Interfaces;
|
||||||
@ -31,6 +34,12 @@ namespace WindowsDataCenter
|
|||||||
protected override void OnStart(string[] args)
|
protected override void OnStart(string[] args)
|
||||||
{
|
{
|
||||||
var configPath = string.Concat(System.Reflection.Assembly.GetEntryAssembly().Location, ".config");
|
var configPath = string.Concat(System.Reflection.Assembly.GetEntryAssembly().Location, ".config");
|
||||||
|
//var configsDir = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "configs")).LocalPath;
|
||||||
|
//var exeName = Assembly.GetEntryAssembly().ManifestModule.ScopeName;
|
||||||
|
//var appConfigPath = Path.Combine(configsDir, string.Format("{0}.config", exeName));
|
||||||
|
//AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", appConfigPath);
|
||||||
|
//var val = ConfigurationManager.AppSettings["TEST"];
|
||||||
|
|
||||||
//Initialise the Ninject system.
|
//Initialise the Ninject system.
|
||||||
var ninjectInstance = NinjectHelper.GetInstance();
|
var ninjectInstance = NinjectHelper.GetInstance();
|
||||||
_logger = NinjectHelper.GetInstance().Get<ILogger>();
|
_logger = NinjectHelper.GetInstance().Get<ILogger>();
|
||||||
@ -42,10 +51,12 @@ namespace WindowsDataCenter
|
|||||||
IsBackground = false,
|
IsBackground = false,
|
||||||
Name = "OWIN SELF HOST MAIN THREAD"
|
Name = "OWIN SELF HOST MAIN THREAD"
|
||||||
};
|
};
|
||||||
//TODO: use app.config for endpoint config.
|
|
||||||
|
var endpointPort = ConfigurationManager.AppSettings["WebsiteHttpPort"] ?? "8800";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_webApp = WebApp.Start<StartOwin>("http://*:8800");
|
var endpoint = string.Format("http://*:{0}", endpointPort);
|
||||||
|
_webApp = WebApp.Start<StartOwin>(endpoint);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user