Browse Source

Make basic demo apps works.

pull/22639/head
maliming 1 year ago
parent
commit
7df23740f7
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 37
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs
  2. 21
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json
  3. 18
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs
  4. 4
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj
  5. 2
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs
  6. 32
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs
  7. 17
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json
  8. 18
      modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs

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

@ -1,31 +1,42 @@
using System; using System;
using System.IO; using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Serilog.Events;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo; namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo;
public class Program public class Program
{ {
public static int Main(string[] args) public async static Task<int> Main(string[] args)
{ {
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug() //TODO: Should be configurable! .MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext() .Enrich.FromLogContext()
.WriteTo.File("Logs/logs.txt") .WriteTo.Async(c => c.Console())
.CreateLogger(); .CreateLogger();
try try
{ {
Log.Information("Starting web host."); Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run(); var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<AbpAspNetCoreMvcUiBootstrapDemoModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex is HostAbortedException)
{
throw;
}
Log.Fatal(ex, "Host terminated unexpectedly!"); Log.Fatal(ex, "Host terminated unexpectedly!");
return 1; return 1;
} }
@ -34,14 +45,4 @@ public class Program
Log.CloseAndFlush(); Log.CloseAndFlush();
} }
} }
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
} }

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

@ -1,27 +1,12 @@
{ {
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51339",
"sslPort": 0
}
},
"profiles": { "profiles": {
"IIS Express": { "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.AbpIo.Commercial.Web": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "http://localhost:5000", "applicationUrl": "https://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
} }
} }
} }

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

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<AbpAspNetCoreMvcUiBootstrapDemoModule>();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}

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

@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" />
<PackageReference Include="Serilog.AspNetCore" /> <PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Sinks.File" /> <PackageReference Include="Serilog.Sinks.Async" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -23,5 +23,5 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
</Project> </Project>

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

@ -55,8 +55,8 @@ public class AbpAspNetCoreMvcUiThemeBasicDemoModule : AbpModule
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
app.MapAbpStaticAssets();
app.UseRouting(); app.UseRouting();
app.MapAbpStaticAssets();
app.UseConfiguredEndpoints(); app.UseConfiguredEndpoints();
} }
} }

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

@ -1,30 +1,42 @@
using System; using System;
using Microsoft.AspNetCore.Hosting; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Serilog.Events;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo;
public class Program public class Program
{ {
public static int Main(string[] args) public async static Task<int> Main(string[] args)
{ {
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug() .MinimumLevel.Debug()
.Enrich.FromLogContext() .Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console()) .WriteTo.Async(c => c.Console())
.CreateLogger(); .CreateLogger();
try try
{ {
Log.Information("Starting web host."); Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run(); var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<AbpAspNetCoreMvcUiThemeBasicDemoModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex is HostAbortedException)
{
throw;
}
Log.Fatal(ex, "Host terminated unexpectedly!"); Log.Fatal(ex, "Host terminated unexpectedly!");
return 1; return 1;
} }
@ -33,14 +45,4 @@ public class Program
Log.CloseAndFlush(); Log.CloseAndFlush();
} }
} }
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
} }

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

@ -1,24 +1,9 @@
{ {
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61659",
"sslPort": 0
}
},
"profiles": { "profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo": { "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "http://localhost:5000", "applicationUrl": "https://localhost:5001",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

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

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<AbpAspNetCoreMvcUiThemeBasicDemoModule>();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
Loading…
Cancel
Save