Browse Source

修改Blaozr Server模式

blazor2
王军 4 years ago
parent
commit
e28005ed18
  1. 40
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/AbpProWebBlazorServerConsts.cs
  2. 362
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/AbpProWebBlazorServerModule.cs
  3. 15
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/Filters/CustomHangfireAuthorizeFilter.cs
  4. 16
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/RecurringJobsExtensions.cs
  5. 141
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/SerilogToEsExtensions.cs
  6. 25
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Lion.AbpPro.Web.Blazor.Server.csproj
  7. 36
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Program.cs
  8. 12
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/appsettings.Development.json
  9. 62
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/appsettings.json
  10. 2
      aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/tempkey.jwk
  11. 8
      aspnet-core/services/src/Lion.AbpPro.Blazor.Layout.AntDesignTheme/Pages/Identity/Users/User.razor.cs
  12. 2
      aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json

40
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/AbpProWebBlazorServerConsts.cs

@ -1,40 +0,0 @@
namespace Lion.AbpPro
{
public class AbpProWebBlazorServerConsts
{
/// <summary>
/// 跨域策略名
/// </summary>
public const string DefaultCorsPolicyName = "Default";
/// <summary>
/// Cookies名称
/// </summary>
public const string DefaultCookieName = "Lion.AbpPro.Http.Api";
/// <summary>
/// SwaggerUi 端点
/// </summary>
public const string SwaggerUiEndPoint = "/swagger";
/// <summary>
/// Hangfire 端点
/// </summary>
public const string HangfireDashboardEndPoint = "/hangfire";
/// <summary>
/// CAP 端点
/// </summary>
public const string CapDashboardEndPoint = "/cap";
public const string MoreEndPoint = "https://doc.cncore.club/";
/// <summary>
/// HMiniprofiler端点
/// </summary>
public const string MiniprofilerEndPoint = "/profiler/results-index";
}
}

362
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/AbpProWebBlazorServerModule.cs

@ -1,376 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hangfire;
using Hangfire.MySql;
using Lion.AbpPro.Blazor.Layout.AntDesignTheme;
using Lion.AbpPro.CAP;
using Lion.AbpPro.ConfigurationOptions;
using Lion.AbpPro.Blazor.Layout.AntDesignTheme;
using Lion.AbpPro.EntityFrameworkCore;
using Lion.AbpPro.Extensions;
using Lion.AbpPro.MultiTenancy;
using Lion.AbpPro.Swaggers;
using Lion.AbpPro.Web.Blazor.Server.Data;
using LionAbpPro.Extensions.Filters;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Savorboard.CAP.InMemoryMessageQueue;
using Serilog;
using StackExchange.Redis;
using Swashbuckle.AspNetCore.SwaggerUI;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Components.Server.Theming;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.BackgroundJobs.Hangfire;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Modularity;
namespace Lion.AbpPro.Web.Blazor.Server
{
[DependsOn(typeof(AbpAutofacModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpProBlazorLayoutAntDesignThemeModule),
typeof(AbpProApplicationModule),
typeof(AbpProHttpApiModule),
typeof(AbpProEntityFrameworkCoreModule),
typeof(AbpAccountWebModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAutofacModule),
typeof(AbpBackgroundJobsHangfireModule),
typeof(AbpProAbpCapModule),
typeof(SharedHostingMicroserviceModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpAspNetCoreComponentsServerThemingModule))]
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpProBlazorLayoutAntDesignThemeModule)
)]
public class AbpProWebBlazorServerModule:AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
ConfigureCache(context);
ConfigureSwaggerServices(context, configuration);
ConfigureOptions(context);
ConfigureJwtAuthentication(context, configuration);
ConfigureHangfireMysql(context);
ConfigurationCap(context);
ConfigurationStsHttpClient(context);
ConfigurationMiniProfiler(context);
context.Services.AddRazorPages();
context.Services.AddServerSideBlazor();
context.Services.AddSingleton<WeatherForecastService>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
var configuration = context.GetConfiguration();
app.UseAbpRequestLocalization();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseMiniProfiler();
app.UseRouting();
app.UseCors(AbpProWebBlazorServerConsts.DefaultCorsPolicyName);
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
if (env.IsDevelopment())
{
app.UseMultiTenancy();
app.UseDeveloperExceptionPage();
}
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API");
options.DocExpansion(DocExpansion.None);
options.DefaultModelsExpandDepth(-1);
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseSerilogRequestLogging(opts =>
{
opts.EnrichDiagnosticContext = SerilogToEsExtensions.EnrichFromRequest;
});
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{
Authorization = new[] { new CustomHangfireAuthorizeFilter() },
IgnoreAntiforgeryToken = true
});
if (configuration.GetValue<bool>("Consul:Enabled", false))
else
{
app.UseConsul();
app.UseExceptionHandler("/Error");
}
}
private void ConfigureHangfireMysql(ServiceConfigurationContext context)
{
Configure<AbpBackgroundJobOptions>(options =>
{
options.IsJobExecutionEnabled = true;
});
context.Services.AddHangfire(config =>
{
config.UseStorage(new MySqlStorage(
context.Services.GetConfiguration().GetConnectionString("Default"),
new MySqlStorageOptions()
{
//CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
//SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
//QueuePollInterval = TimeSpan.Zero,
//UseRecommendedIsolationLevel = true,
//DisableGlobalLocks = true
}));
});
}
/// <summary>
/// 配置MiniProfiler
/// </summary>
/// <param name="context"></param>
private void ConfigurationMiniProfiler(ServiceConfigurationContext context)
{
context.Services.AddMiniProfiler(options => options.RouteBasePath = "/profiler")
.AddEntityFramework();
}
/// <summary>
/// 配置JWT
/// </summary>
/// <param name="context"></param>
/// <param name="configuration"></param>
private void ConfigureJwtAuthentication(ServiceConfigurationContext context,
IConfiguration configuration)
{
context.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters =
new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
{
// 是否开启签名认证
ValidateIssuerSigningKey = true,
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
//ClockSkew = TimeSpan.Zero,
ValidIssuer = configuration["Jwt:Issuer"],
ValidAudience = configuration["Jwt:Audience"],
IssuerSigningKey =
new SymmetricSecurityKey(
Encoding.ASCII.GetBytes(configuration["Jwt:SecurityKey"]))
};
options.Events = new JwtBearerEvents
{
OnMessageReceived = currentContext =>
{
var path = currentContext.HttpContext.Request.Path;
if (path.StartsWithSegments("/login"))
{
return Task.CompletedTask;
}
var accessToken =
currentContext.Request.Query["access_token"].FirstOrDefault() ??
currentContext.Request.Cookies[
AbpProWebBlazorServerConsts.DefaultCookieName];
if (accessToken.IsNullOrWhiteSpace())
{
return Task.CompletedTask;
}
if (path.StartsWithSegments("/signalr"))
{
currentContext.Token = accessToken;
}
currentContext.Request.Headers.Remove("Authorization");
currentContext.Request.Headers.Add("Authorization",
$"Bearer {accessToken}");
// 如果请求来自hangfire 或者cap
if (path.ToString().StartsWith("/hangfire") ||
path.ToString().StartsWith("/cap"))
{
// currentContext.HttpContext.Response.Headers.Remove(
// "X-Frame-Options");
currentContext.Token = accessToken;
}
app.UseStaticFiles();
return Task.CompletedTask;
}
};
});
}
/// <summary>
/// 配置options
/// </summary>
/// <param name="context"></param>
private void ConfigureOptions(ServiceConfigurationContext context)
{
context.Services.Configure<JwtOptions>(context.Services.GetConfiguration()
.GetSection("Jwt"));
}
/// <summary>
/// Redis缓存
/// </summary>
private void ConfigureCache(ServiceConfigurationContext context)
{
Configure<AbpDistributedCacheOptions>(
options => { options.KeyPrefix = "AbpPro:"; });
var configuration = context.Services.GetConfiguration();
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
}
private void ConfigurationStsHttpClient(ServiceConfigurationContext context)
{
context.Services.AddHttpClient(context.Services.GetConfiguration().GetSection("HttpClient:Sts:Name").Value,
options =>
{
options.BaseAddress =
new Uri(context.Services.GetConfiguration().GetSection("HttpClient:Sts:Url")
.Value);
});
}
private void ConfigureConventionalControllers()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
app.UseRouting();
// app.MapBlazorHub();
// app.MapFallbackToPage("/_Host");
app.UseEndpoints(endpoints =>
{
options.ConventionalControllers.Create(typeof(AbpProApplicationModule)
.Assembly);
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
private static void ConfigureSwaggerServices(ServiceConfigurationContext context,
IConfiguration configuration)
{
context.Services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("AbpPro",
new OpenApiInfo { Title = "LionAbpPro API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
//TODO
// options.EnableAnnotations(); // 启用注解
options.DocumentFilter<HiddenAbpDefaultApiFilter>();
options.SchemaFilter<EnumSchemaFilter>();
// 加载所有xml注释,这里会导致swagger加载有点缓慢
var xmls = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
foreach (var xml in xmls)
{
options.IncludeXmlComments(xml, true);
}
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme,
new OpenApiSecurityScheme()
{
Description = "直接在下框输入JWT生成的Token",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = JwtBearerDefaults.AuthenticationScheme,
BearerFormat = "JWT"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = "Bearer"
}
},
new List<string>()
}
});
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme()
{
Type = SecuritySchemeType.ApiKey,
In = ParameterLocation.Header,
Name = "Accept-Language",
Description = "多语言设置,系统预设语言有zh-Hans、en,默认为zh-Hans"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
new string[] { }
}
});
});
}
private void ConfigurationCap(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var enabled = configuration.GetValue<bool>("Cap:Enabled", false);
if (enabled)
{
context.AddAbpCap(capOptions =>
{
capOptions.UseEntityFramework<AbpProDbContext>();
capOptions.UseRabbitMQ(option =>
{
option.HostName = configuration.GetValue<string>("Cap:RabbitMq:HostName");
option.UserName = configuration.GetValue<string>("Cap:RabbitMq:UserName");
option.Password = configuration.GetValue<string>("Cap:RabbitMq:Password");
});
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
capOptions.UseDashboard(options => { options.UseAuth = auth; });
});
}
else
{
context.AddAbpCap(capOptions =>
{
capOptions.UseInMemoryStorage();
capOptions.UseInMemoryMessageQueue();
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
capOptions.UseDashboard(options => { options.UseAuth = auth; });
});
}
}
}
}

15
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/Filters/CustomHangfireAuthorizeFilter.cs

@ -1,15 +0,0 @@
using Hangfire.Dashboard;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Users;
namespace LionAbpPro.Extensions.Filters
{
public class CustomHangfireAuthorizeFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
var _currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
return _currentUser.IsAuthenticated;
}
}
}

16
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/RecurringJobsExtensions.cs

@ -1,16 +0,0 @@
// using Hangfire;
// using Microsoft.Extensions.DependencyInjection;
// using System;
// using LionAbpPro.Jobs;
//
// namespace LionAbpPro.Extensions
// {
// public static class RecurringJobsExtensions
// {
// public static void CreateRecurringJob(this IServiceProvider service)
// {
// var job = service.GetService<TestJob>();
// RecurringJob.AddOrUpdate("测试Job", () => job.ExecuteAsync(), CronTypeHelper.Minute(1));
// }
// }
// }

141
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Extensions/SerilogToEsExtensions.cs

@ -1,141 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Serilog;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Serilog.Exceptions;
using Serilog.Exceptions.Core;
using Serilog.Sinks.Elasticsearch;
namespace Lion.AbpPro.Extensions
{
public static class SerilogToEsExtensions
{
public static void SetSerilogConfiguration(LoggerConfiguration loggerConfiguration, IConfiguration configuration,
IHostEnvironment hostingEnvironment)
{
// 默认读取 configuration 中 "Serilog" 节点下的配置
loggerConfiguration.ReadFrom.Configuration(configuration)
.Enrich.WithExceptionDetails()
.Enrich.WithExceptionDetails(new DestructuringOptionsBuilder()
.WithDefaultDestructurers()
)
.Enrich.FromLogContext()
.WriteTo.Console();
if (hostingEnvironment.IsDevelopment())
{
loggerConfiguration.WriteTo.File("logs/logs.txt", rollingInterval: RollingInterval.Day);
}
loggerConfiguration.WriteTo.File("logs/logs.txt", rollingInterval: RollingInterval.Day);
var writeToElasticSearch = configuration.GetValue("ElasticSearch:Enabled", false);
// LogToElasticSearch:Enabled = true 才输出至ES
if (!writeToElasticSearch)
return;
var applicationName = "Lion.AbpPro.HttpApi.Host";
var esUrl = configuration["ElasticSearch:Url"];
// 需要设置ES URL
if (string.IsNullOrEmpty(esUrl))
return;
var indexFormat = configuration["ElasticSearch:IndexFormat"];
// 需要设置ES URL
if (string.IsNullOrEmpty(indexFormat))
return;
var esUserName = configuration["ElasticSearch:UserName"];
var esPassword = configuration["ElasticSearch:Password"];
loggerConfiguration.Enrich.FromLogContext().Enrich.WithExceptionDetails().WriteTo
.Elasticsearch(BuildElasticSearchSinkOptions(esUrl, indexFormat, esUserName, esPassword));
loggerConfiguration.Enrich.WithProperty("Application", applicationName);
}
// 创建Es连接
private static ElasticsearchSinkOptions BuildElasticSearchSinkOptions(
string url,
string indexFormat,
string userName,
string password)
{
if (string.IsNullOrEmpty(userName))
{
return new ElasticsearchSinkOptions(new Uri(url))
{
AutoRegisterTemplate = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
IndexFormat = indexFormat
};
}
return new ElasticsearchSinkOptions(new Uri(url))
{
AutoRegisterTemplate = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
IndexFormat = indexFormat,
ModifyConnectionSettings = x => x.BasicAuthentication(userName, password)
};
}
public static void EnrichFromRequest(IDiagnosticContext diagnosticContext, HttpContext httpContext)
{
var request = httpContext.Request;
// 为每个请求都设置通用的属性
diagnosticContext.Set("Host", request.Host);
diagnosticContext.Set("Protocol", request.Protocol);
diagnosticContext.Set("Scheme", request.Scheme);
diagnosticContext.Set("RemoteIpAddress", httpContext.Connection.RemoteIpAddress);
// 如果要记录 Request Body 或 Response Body
// 参考 https://stackoverflow.com/questions/60076922/serilog-logging-web-api-methods-adding-context-properties-inside-middleware
string requestBody = ReadRequestBody(httpContext.Request).Result;
if (!string.IsNullOrEmpty(requestBody))
{
diagnosticContext.Set("RequestBody", requestBody);
}
// string responseBody = ReadResponseBody(httpContext.Response).Result;
// if (!string.IsNullOrEmpty(responseBody))
// {
// diagnosticContext.Set("ResponseBody", requestBody);
// }
if (request.QueryString.HasValue)
{
diagnosticContext.Set("QueryString", request.QueryString.Value);
}
}
private static async Task<string> ReadRequestBody(HttpRequest request)
{
HttpRequestRewindExtensions.EnableBuffering(request);
var body = request.Body;
var buffer = new byte[Convert.ToInt32(request.ContentLength)];
await request.Body.ReadAsync(buffer, 0, buffer.Length);
string requestBody = Encoding.UTF8.GetString(buffer);
body.Seek(0, SeekOrigin.Begin);
request.Body = body;
return $"{requestBody}";
}
private static async Task<string> ReadResponseBody(HttpResponse response)
{
response.Body.Seek(0, SeekOrigin.Begin);
string responseBody = await new StreamReader(response.Body).ReadToEndAsync();
response.Body.Seek(0, SeekOrigin.Begin);
return $"{responseBody}";
}
}
}

25
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Lion.AbpPro.Web.Blazor.Server.csproj

@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
@ -7,33 +7,18 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.Web" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.AspNetCore" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.Theming" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.Autofac" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="5.0.0-rc.1" />
<PackageReference Include="Serilog" Version="$(SerilogVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCoreVersion)" />
<PackageReference Include="Serilog.Exceptions" Version="$(SerilogExceptionsVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingVersion)" />
<PackageReference Include="Serilog.Settings.Configuration" Version="$(SerilogSettingsConfigurationVersion)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsoleVersion)" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="$(SerilogSinksElasticsearchVersion)" />
<PackageReference Include="Serilog.Sinks.File" Version="$(SerilogSinksFileVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.1.9" />
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" Version="5.0.0-rc.1" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.0.0-rc.1" />
<PackageReference Include="Hangfire.MySqlStorage" Version="$(HangfireMySqlStorageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="$(MicrosoftVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="$(AbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="$(AbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\frameworks\CAP\src\Lion.AbpPro.CAP\Lion.AbpPro.CAP.csproj" />
<ProjectReference Include="..\..\..\shared\Lion.AbpPro.Shared.Hosting.Microservices\Lion.AbpPro.Shared.Hosting.Microservices.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.Application\Lion.AbpPro.Application.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.Blazor.Layout.AntDesignTheme\Lion.AbpPro.Blazor.Layout.AntDesignTheme.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.HttpApi.Client\Lion.AbpPro.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\src\Lion.AbpPro.HttpApi\Lion.AbpPro.HttpApi.csproj" />
</ItemGroup>
</Project>

36
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Program.cs

@ -7,17 +7,47 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Serilog;
using Serilog.Events;
namespace Lion.AbpPro.Web.Blazor.Server
{
public class Program
{
public static void Main(string[] args)
public static int Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
try
{
Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{

12
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/appsettings.Development.json

@ -1,10 +1,8 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
"ConnectionStrings": {
"Default": "Data Source=120.24.194.14;Port=3307;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Redis": {
"Configuration": "localhost,password=mypassword,defaultdatabase=1"
}
}

62
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/appsettings.json

@ -1,60 +1,10 @@
{
"Serilog": {
"MinimumLevel": {
"Logging": {
"LogLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"Volo.Abp": "Information",
"Hangfire": "Information",
"DotNetCore.CAP": "Information",
"Serilog.AspNetCore": "Information"
}
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"App": {
"SelfUrl": "http://localhost:44315",
"CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100"
},
"ConnectionStrings": {
"Default": "Data Source=120.24.194.14;Port=3307;Database=LionAbpProDB;uid=root;pwd=1ss*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Redis": {
"Configuration": "localhost,password=mypassword,defaultdatabase=1"
},
"Jwt": {
"Audience": "LionAbpPro",
//
"SecurityKey": "dzehzRz9a8asdfasfdadfasdfasdfafsdadfasbasdf=",
"Issuer": "LionAbpPro",
//
"ExpirationTime": 24
// hour
},
"Cap": {
"Enabled": "false",
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "admin"
}
},
"ElasticSearch": {
"Enabled": "false",
"Url": "http://es.cn",
"IndexFormat": "companyname.projectname.development.{0:yyyy.MM.dd}",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy",
"SearchIndexFormat": "companyname.projectname.development*"
},
"HttpClient": {
"Sts": {
"Name": "Sts",
"Url": "http://localhost:44354"
}
},
"Consul": {
"Enabled": false,
"Host": "http://localhost:8500",
"Service": "Project-Service"
}
}
"AllowedHosts": "*"
}

2
aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/tempkey.jwk

@ -1 +1 @@
{"AdditionalData":{},"Alg":"RS256","Crv":null,"D":"PAgZOVLyS9SDqZAG-veT2mLtljxhIWaEMGGaesaCzp_8NSQSZD-ZKJCnht8zaG3I73PQ1Q3eFff11yLL80WP2v43LE-m735Rm-hWL7QCAIuSvPLgx4hwyKDs6KTYKFhiOjtjnMJP5g22ETR9yOeEswhjDvgcBdHcau0aQyELQnk9HtkS-TlaCykWjRy_uJ_mLrp8qNdrVQ3nvO62ps_W0x4F4gv8Kwi_dzaqz2PVm6ZidJrF8fi7k1JtL1lcvL1-ESGVna7sNsnvFxxw98FsjR4RYTxAzai9rDFd4IbSf0Rak671cf8OT0-R0oN5Ntv7_jRH07_TJBtAaBieDUbt-Q","DP":"cpUOYvSsJQvTtjSI_ZL6k4K7pNQNgKNnL6BranMysv-x0NDy_74do7-sllvvsoPv1JbIWcqAUSAZpdaXKd9073-H-G8twds5yNS957FlSFaayCwHlFLUmyy27GMuyucEtzHruMH_8ZPSTVnCJJITFzXAnFPAJVfx7T2L7MxITbs","DQ":"E4agTm5ODGyARTv-X01HYRS8K47gPjplsqA7TA1RhzXy4jvjx2WiYoim6ji3bpKBshpswbQdBrMbAGeeb2C9rYTCJP9TpTC3JTlOBG2ZDFMtsPoiTA4Fq7EUxJtTOTNv9F81atNy1DpAOgdahHPNr2eov824AiXdgPDEIwO1XKc","E":"AQAB","K":null,"KeyId":"976444C5D95614D7E51B38BA04ABAD68","Kid":"976444C5D95614D7E51B38BA04ABAD68","Kty":"RSA","N":"u0IUokDRXdT1IdhhzmpI42ZgFAG_MwAwoLacKdRyZ0-yqlhbiQEdH5SUvqZ4bcYp7iu42iN4ppCndISCZrX6yq5EaULienJnNPpx5x8K_0_-7yG5Tz1XbQZhDtBFLLlu79BnnsotFna6m3V46dC-NaA0iE_e1RvIsPCjLhLwkX9voyminkH3s7cW7PeUEFbmAM2Wry1qavKKLvg49nRpqUuZREIofvwVA6OK_NDzWJjrX9FE5XHOCYgq9dNmeZ0J-C9W-tBdio4FNNrmDfw9P75H42FmXWqA5txjpEO-IfV7X5gOfrGAWtMGkb5uFsLw4MdIMLp22wDXrEdb5cgzjQ","Oth":null,"P":"8qMb3guW5dYik2t3mdxzGJo-P70vJV7iBhFx_8YCL3MXLFWPhwtV2b8BBIdoYkwrHcZarcdB2QLCx-Usy4E8KvNMcDCfWqQOsOLEBpQWaf4GKRmysiRi8h9u5BFDtFAIlneMv4UfMGEK0h4WkV5AvqcJY5XtkC8s8yZVEZh23TM","Q":"xZIxw3kA29tZRnuJtwYnOPWTUb0JpejV8maaPFazOZEE3mUu4ynZCReTBqpB-k5ZHL0ytwheVmfbxrbLWnBeyjl0jEp9UCFfNkjuo2EDClMo_jbpCzKy9JttqwasRLg6zgwqSuTBBlO7FJNeapIWf2amsWeB1SaFyFw2sXVxLD8","QI":"DQt4wr2gqoSG7WIaupeNIvbDbes4BD3Fu7iH-oWvSZEpJqpZ8hlIVOPdWv2aPN7JDSGGIQpyX_VqTSp1cF6OZFdO4b7Nbdm0iB9eeQNI0E8GLcS54HFI2mJq-6bLNdeNwSIlCZzjkl8cqmnLZd_3cSymlFrJP_zbyLSA26qVVZQ","Use":null,"X":null,"X5t":null,"X5tS256":null,"X5u":null,"Y":null,"KeySize":2048,"HasPrivateKey":true,"CryptoProviderFactory":{"CryptoProviderCache":{},"CustomCryptoProvider":null,"CacheSignatureProviders":true,"SignatureProviderObjectPoolCacheSize":64}}
{"alg":"RS256","d":"gUuQ6oykf8wOH1p8ZYIjXeo0RveSJfyddevgVlKp3GNp9r3dqqV_yNJlSgfqWPRkPEnjHS7n9gQ7-zUylPSbxgNIrtbWhMdH74WZFhGzSGxn9X9o8n7aVR4rsVzoUTzeFx7FPDt3-JfuVeJW6984AJktsCZZe5I14u0macrl4s17QvNGUYPQWb6bzkUWZjgRiGxrGheK7HOqe3wde0M9i2A-t0OGtfk8Qlq5I4bhRKpMJfyeFcxf1VtmNAsnZrqKEBo1L6z9VJrNl2lf_IF7-QB2sCz6gWaGH7GKG88ybRA-_W8ysetPnGKMDi9Zg9wQMDSLuFlus-2Emk0KO_SS7Q","dp":"GcocMxoDIwCZgfqN7WdTof9YMoWwZIcHZWJadukLP2c19HdHXsaRocfKHgl5q2LLyR8KU9DQfNjAfIQcPiv1-la20ApxiejbR8ENfuaZCLceX9YTkfim3wOKZXBXCsK0K9b3ck8YWovQdIDtuMluXFxm1tdpIQHZPMicRHnWn8U","dq":"Ue1fXgcC2gupLdcQMz6UJ-aspi5qkxDrTCOpXMkj352jT2UT0NvkaiPFfrOCjtF47BIQATLQzJXC1dkRo3YwYM_RdF05JZqLkfppz1n_2B2j8jWbkRQAnVZO4kxVp5HxAJL_aLkMQVJrSk6to84wkcIox3M5Ef8hUnH-V_7gba0","e":"AQAB","kid":"B7C6A0AA3146A664EDE402E4FD323B04","kty":"RSA","n":"vRrzOGoq4qSyqGpU3OhBZ4Ch5OhNdMlfn7T86_hBCG8lONPeS6AxcX4VeO_W9je1u6vsC16HyKEfNSrgOujE0jcZ-nSc50cyC8QyxsanTeKrwlzxoYPV3BcQF1vWPN_h8uYjfujy2ruOYzIC_rFHJ_VurUHAGpNlVyX-ivZiCSfScIeFrlBjJM3CbcHZCG7vDsssX6ZLNvmdHzBwEEKFWOczKpX3pjJplD1F57ljPcdl3y6lAHxGJBUZT3wl9njVLNvg6P73LMACZOq9FPKCmYUly0_kKoriX-EQ8sQXxW3jT0n2r--niHPFxFo0lKrDzVtzIzvrv7ybL8NrAva_BQ","p":"5lSinXyf0T4L85UacVs7AUo_AEZvBIPeqZx_T7v54CEewksSJKENVsdFNaROmGb1Cuncy0p1jpdQ6Xvf-9IYFRiH4DobXReOJobYtzqtbwPyAj-c7EMDIM7b0lLodHGN8FcxPCn1CHLQE5W-DckgyVLu4Qd2-pd8xw8tdevfrls","q":"0i4meaPvQVfMJUfzwdtRDkdGnhWIcVBfiDeIO1mn3JSVKjujTcf5fJCKjpdAa06AxF0yhOiXMWPI4Tvw-T54XSiRd_rYH8ix8Mmpy7pTMldOBehytXVdT2qv7-sTTLziV7R7BEYJmpzlptTjdvL_Drfkra-3Qj3iO6OSq1Vnhh8","qi":"1P1Wl2lvf3Cz8il6XuUBcWI8NVMyfCSwYshl-u5C5NDa1aAs16GI7Bd2TQjS06OmVRyr3nSTj1-0qc3hWKVJWZ9qYPMpC1AaNhKXPshMALUpqwPi9pKL4C0W6QKKIA9xtVZjsEr-v3v0r8cPtJNAkCQAAkX_eLqgbdWsY2DVBO0"}

8
aspnet-core/services/src/Lion.AbpPro.Blazor.Layout.AntDesignTheme/Pages/Identity/Users/User.razor.cs

@ -1,17 +1,15 @@
using System.Threading.Tasks;
using Lion.AbpPro.Users;
using Lion.AbpPro.Users.Dtos;
using Microsoft.AspNetCore.Components;
namespace Lion.AbpPro.Blazor.Layout.AntDesignTheme.Pages.Identity.Users;
public partial class User
{
private readonly IAccountAppService _accountAppService;
[Inject] protected IAccountAppService _accountAppService { get; set; }
public User(IAccountAppService accountAppService)
{
_accountAppService = accountAppService;
}
protected override async Task OnInitializedAsync()
{

2
aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json

@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"Default": "Data Source=localhost;Database=LionAbpProDB;uid=root;pwd=123456;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
"Default": "Data Source=localhost;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}
}
Loading…
Cancel
Save