Skip to content

Commit

Permalink
Updated Program.cs for Templates (#9930)
Browse files Browse the repository at this point in the history
* Fixes# 9882
  • Loading branch information
ns8482e authored Sep 2, 2021
1 parent 97899d3 commit 5decf3c
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 75 deletions.
46 changes: 12 additions & 34 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,9 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start http://localhost:5000"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
}
},
{
Expand All @@ -54,13 +44,9 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start http://localhost:5000"
}
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
}
},
{
Expand All @@ -82,13 +68,9 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start http://localhost:5000"
}
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
}
},
{
Expand All @@ -104,13 +86,9 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start http://localhost:5000"
}
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
}
},
{
Expand Down
19 changes: 10 additions & 9 deletions src/OrchardCore.Cms.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
Expand All @@ -8,16 +7,18 @@ namespace OrchardCore.Cms.Web
{
public class Program
{
public static Task Main(string[] args)
=> BuildHost(args).RunAsync();
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHost BuildHost(string[] args) =>
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging => logging.ClearProviders())
.ConfigureWebHostDefaults(webBuilder => webBuilder
.UseStartup<Startup>()
.UseNLogWeb())
.Build()
;
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseNLogWeb();
});
}
}
17 changes: 10 additions & 7 deletions src/OrchardCore.Mvc.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace OrchardCore.Mvc.Web
{
public class Program
{
public static Task Main(string[] args)
=> BuildHost(args).RunAsync();
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHost BuildHost(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>())
.Build();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
Expand All @@ -14,10 +13,12 @@ namespace OrchardCore.Templates.Cms.Web
{
public class Program
{
public static Task Main(string[] args)
=> BuildHost(args).RunAsync();
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHost BuildHost(string[] args) =>
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(logging => logging.ClearProviders())
#if (UseSerilog)
Expand All @@ -27,11 +28,12 @@ public static IHost BuildHost(string[] args) =>
.Enrich.FromLogContext();
})
#endif
.ConfigureWebHostDefaults(webBuilder => webBuilder
.ConfigureWebHostDefaults(webBuilder =>
{
#if (UseNLog)
.UseNLogWeb()
webBuilder.UseNLogWeb();
#endif
.UseStartup<Startup>()
).Build();
webBuilder.UseStartup<Startup>();
});
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace OrchardCore.Templates.Mvc.Web
{
public class Program
{
public static Task Main(string[] args)
=> BuildHost(args).RunAsync();
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHost BuildHost(string[] args)
=> Host.CreateDefaultBuilder(args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
webBuilder.UseStartup<Startup>())
.Build();
{
webBuilder.UseStartup<Startup>();
});
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8080",
"sslPort": 44300
Expand All @@ -15,7 +15,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OrchardCore.Templates.Cms.Web": {
"OrchardCore.Templates.Mvc.Web": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace OrchardCore.Application.Pages
{
public class Program
{
public static Task Main(string[] args)
=> BuildHost(args).RunAsync();
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHost BuildHost(string[] args)
=> Host.CreateDefaultBuilder(args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
webBuilder.UseStartup<Startup>())
.Build();
{
webBuilder.UseStartup<Startup>();
});
}
}

0 comments on commit 5decf3c

Please sign in to comment.