Compare commits
No commits in common. "c63a48af6ef16a656fe28fa02f066bea1fc06dc6" and "15241429fce0987f887901430a7ad07b45e9972b" have entirely different histories.
c63a48af6e
...
15241429fc
|
@ -6,8 +6,6 @@ using NetworkResurrector.Agent.Extensions;
|
||||||
using NetworkResurrector.Agent.Extensions.Serilog;
|
using NetworkResurrector.Agent.Extensions.Serilog;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NetworkResurrector.Agent
|
namespace NetworkResurrector.Agent
|
||||||
{
|
{
|
||||||
|
@ -15,24 +13,7 @@ namespace NetworkResurrector.Agent
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isConsole = Debugger.IsAttached || args.Contains("--console");
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
WebApplicationBuilder builder;
|
|
||||||
if (isConsole)
|
|
||||||
{
|
|
||||||
builder = WebApplication.CreateBuilder(args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var webApplicationOptions = new WebApplicationOptions()
|
|
||||||
{
|
|
||||||
ContentRootPath = AppContext.BaseDirectory,
|
|
||||||
Args = args,
|
|
||||||
ApplicationName = Process.GetCurrentProcess().ProcessName
|
|
||||||
};
|
|
||||||
builder = WebApplication.CreateBuilder(webApplicationOptions);
|
|
||||||
builder.Host.UseWindowsService();
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Host.UseSerilog((_, lc) =>
|
builder.Host.UseSerilog((_, lc) =>
|
||||||
{
|
{
|
||||||
|
@ -46,6 +27,10 @@ namespace NetworkResurrector.Agent
|
||||||
|
|
||||||
builder.Services.ConfigureServices(builder.Configuration);
|
builder.Services.ConfigureServices(builder.Configuration);
|
||||||
|
|
||||||
|
var useWindowsService = builder.Configuration.GetValue<bool>("Host:UseWindowsService");
|
||||||
|
if (useWindowsService)
|
||||||
|
builder.Host.UseWindowsService();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
app.Configure(builder.Configuration);
|
app.Configure(builder.Configuration);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
-->
|
-->
|
||||||
<Project>
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
|
@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
|
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
||||||
},
|
},
|
||||||
|
"Host": {
|
||||||
|
"UseWindowsService": true
|
||||||
|
},
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
|
|
@ -5,8 +5,6 @@ using Microsoft.Extensions.Hosting;
|
||||||
using NetworkResurrector.Server.Extensions;
|
using NetworkResurrector.Server.Extensions;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NetworkResurrector.Server
|
namespace NetworkResurrector.Server
|
||||||
{
|
{
|
||||||
|
@ -14,24 +12,7 @@ namespace NetworkResurrector.Server
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var isConsole = Debugger.IsAttached || args.Contains("--console");
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
WebApplicationBuilder builder;
|
|
||||||
if (isConsole)
|
|
||||||
{
|
|
||||||
builder = WebApplication.CreateBuilder(args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var webApplicationOptions = new WebApplicationOptions()
|
|
||||||
{
|
|
||||||
ContentRootPath = AppContext.BaseDirectory,
|
|
||||||
Args = args,
|
|
||||||
ApplicationName = Process.GetCurrentProcess().ProcessName
|
|
||||||
};
|
|
||||||
builder = WebApplication.CreateBuilder(webApplicationOptions);
|
|
||||||
builder.Host.UseWindowsService();
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Host.UseSerilog((_, lc) =>
|
builder.Host.UseSerilog((_, lc) =>
|
||||||
{
|
{
|
||||||
|
@ -43,6 +24,11 @@ namespace NetworkResurrector.Server
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.ConfigureServices(builder.Configuration);
|
builder.Services.ConfigureServices(builder.Configuration);
|
||||||
|
|
||||||
|
var useWindowsService = builder.Configuration.GetValue<bool>("Host:UseWindowsService");
|
||||||
|
if (useWindowsService)
|
||||||
|
builder.Host.UseWindowsService();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
app.Configure();
|
app.Configure();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
-->
|
-->
|
||||||
<Project>
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
|
@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
|
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
"DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true"
|
||||||
},
|
},
|
||||||
|
"Host": {
|
||||||
|
"UseWindowsService": false
|
||||||
|
},
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
|
Loading…
Reference in New Issue