Skip to content

Commit 7df2374

Browse files
committed
Make basic demo apps works.
1 parent 76e5159 commit 7df2374

File tree

8 files changed

+43
-106
lines changed

8 files changed

+43
-106
lines changed
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
using System;
2-
using System.IO;
3-
using Microsoft.AspNetCore.Hosting;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.Extensions.DependencyInjection;
45
using Microsoft.Extensions.Hosting;
56
using Serilog;
6-
using Serilog.Events;
77

88
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo;
99

1010
public class Program
1111
{
12-
public static int Main(string[] args)
12+
public async static Task<int> Main(string[] args)
1313
{
1414
Log.Logger = new LoggerConfiguration()
15-
.MinimumLevel.Debug() //TODO: Should be configurable!
16-
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
15+
.MinimumLevel.Debug()
1716
.Enrich.FromLogContext()
18-
.WriteTo.File("Logs/logs.txt")
17+
.WriteTo.Async(c => c.Console())
1918
.CreateLogger();
2019

2120
try
2221
{
2322
Log.Information("Starting web host.");
24-
CreateHostBuilder(args).Build().Run();
23+
var builder = WebApplication.CreateBuilder(args);
24+
builder.Host.AddAppSettingsSecretsJson()
25+
.UseAutofac()
26+
.UseSerilog();
27+
await builder.AddApplicationAsync<AbpAspNetCoreMvcUiBootstrapDemoModule>();
28+
var app = builder.Build();
29+
await app.InitializeApplicationAsync();
30+
await app.RunAsync();
2531
return 0;
2632
}
2733
catch (Exception ex)
2834
{
35+
if (ex is HostAbortedException)
36+
{
37+
throw;
38+
}
39+
2940
Log.Fatal(ex, "Host terminated unexpectedly!");
3041
return 1;
3142
}
@@ -34,14 +45,4 @@ public static int Main(string[] args)
3445
Log.CloseAndFlush();
3546
}
3647
}
37-
38-
39-
internal static IHostBuilder CreateHostBuilder(string[] args) =>
40-
Host.CreateDefaultBuilder(args)
41-
.ConfigureWebHostDefaults(webBuilder =>
42-
{
43-
webBuilder.UseStartup<Startup>();
44-
})
45-
.UseAutofac()
46-
.UseSerilog();
4748
}
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:51339",
7-
"sslPort": 0
8-
}
9-
},
102
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
17-
},
18-
"Volo.AbpIo.Commercial.Web": {
3+
"Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo": {
194
"commandName": "Project",
205
"launchBrowser": true,
21-
"applicationUrl": "http://localhost:5000",
6+
"applicationUrl": "https://localhost:5000",
227
"environmentVariables": {
238
"ASPNETCORE_ENVIRONMENT": "Development"
249
}
2510
}
2611
}
27-
}
12+
}

modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" />
1212
<PackageReference Include="Serilog.AspNetCore" />
13-
<PackageReference Include="Serilog.Sinks.File" />
13+
<PackageReference Include="Serilog.Sinks.Async" />
1414
</ItemGroup>
1515

1616
<ItemGroup>
@@ -23,5 +23,5 @@
2323
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2424
</None>
2525
</ItemGroup>
26-
26+
2727
</Project>

modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
5555
app.UseDeveloperExceptionPage();
5656
}
5757

58-
app.MapAbpStaticAssets();
5958
app.UseRouting();
59+
app.MapAbpStaticAssets();
6060
app.UseConfiguredEndpoints();
6161
}
6262
}
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
using System;
2-
using Microsoft.AspNetCore.Hosting;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.Extensions.DependencyInjection;
35
using Microsoft.Extensions.Hosting;
46
using Serilog;
5-
using Serilog.Events;
67

78
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo;
89

910
public class Program
1011
{
11-
public static int Main(string[] args)
12+
public async static Task<int> Main(string[] args)
1213
{
1314
Log.Logger = new LoggerConfiguration()
1415
.MinimumLevel.Debug()
1516
.Enrich.FromLogContext()
16-
.WriteTo.Async(c => c.File("Logs/logs.txt"))
1717
.WriteTo.Async(c => c.Console())
1818
.CreateLogger();
1919

2020
try
2121
{
2222
Log.Information("Starting web host.");
23-
CreateHostBuilder(args).Build().Run();
23+
var builder = WebApplication.CreateBuilder(args);
24+
builder.Host.AddAppSettingsSecretsJson()
25+
.UseAutofac()
26+
.UseSerilog();
27+
await builder.AddApplicationAsync<AbpAspNetCoreMvcUiThemeBasicDemoModule>();
28+
var app = builder.Build();
29+
await app.InitializeApplicationAsync();
30+
await app.RunAsync();
2431
return 0;
2532
}
2633
catch (Exception ex)
2734
{
35+
if (ex is HostAbortedException)
36+
{
37+
throw;
38+
}
39+
2840
Log.Fatal(ex, "Host terminated unexpectedly!");
2941
return 1;
3042
}
@@ -33,14 +45,4 @@ public static int Main(string[] args)
3345
Log.CloseAndFlush();
3446
}
3547
}
36-
37-
38-
internal static IHostBuilder CreateHostBuilder(string[] args) =>
39-
Host.CreateDefaultBuilder(args)
40-
.ConfigureWebHostDefaults(webBuilder =>
41-
{
42-
webBuilder.UseStartup<Startup>();
43-
})
44-
.UseAutofac()
45-
.UseSerilog();
4648
}

modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:61659",
7-
"sslPort": 0
8-
}
9-
},
102
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"environmentVariables": {
15-
"ASPNETCORE_ENVIRONMENT": "Development"
16-
}
17-
},
183
"Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo": {
194
"commandName": "Project",
205
"launchBrowser": true,
21-
"applicationUrl": "http://localhost:5000",
6+
"applicationUrl": "https://localhost:5001",
227
"environmentVariables": {
238
"ASPNETCORE_ENVIRONMENT": "Development"
249
}

modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)