build: 升级依赖支持 NETCore 3.0

更新 Longbow.Logging
This commit is contained in:
Argo Zhang 2019-09-27 00:46:31 +08:00
parent db6e1cf657
commit ab4f7ebd9e
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
6 changed files with 29 additions and 24 deletions

View File

@ -84,8 +84,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{85574E
src\admin\Bootstrap.Admin\Linux.Dockerfile = src\admin\Bootstrap.Admin\Linux.Dockerfile
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.Security.Mvc", "..\Utility\Bootstrap.Security.Mvc\src\Bootstrap.Security.Mvc\Bootstrap.Security.Mvc.csproj", "{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -120,10 +118,6 @@ Global
{BC1C6D63-ADA9-4C3B-89F0-CEB191A86BF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC1C6D63-ADA9-4C3B-89F0-CEB191A86BF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC1C6D63-ADA9-4C3B-89F0-CEB191A86BF5}.Release|Any CPU.Build.0 = Release|Any CPU
{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -143,7 +137,6 @@ Global
{843811A2-FE49-410F-BF9F-9F1FB14A1DEE} = {C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}
{BC1C6D63-ADA9-4C3B-89F0-CEB191A86BF5} = {C7F51A14-2D89-4D1F-AD78-C42B79AB0BF0}
{E03B7391-B52F-4449-B400-5CD9DE01F085} = {41B6D37A-5E5E-42B3-85E4-D81A81E3D757}
{A44BB5C0-BB27-482B-B1F1-DF79AC070C4E} = {E03B7391-B52F-4449-B400-5CD9DE01F085}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC}

View File

@ -12,14 +12,17 @@
<ItemGroup>
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.2.21" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.0" />
<PackageReference Include="Longbow.Configuration" Version="2.2.7" />
<PackageReference Include="Longbow.Logging" Version="3.0.0" />
<PackageReference Include="Longbow.Tasks" Version="2.2.23" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Utility\Bootstrap.Security.Mvc\src\Bootstrap.Security.Mvc\Bootstrap.Security.Mvc.csproj" />
<ProjectReference Include="..\Bootstrap.DataAccess\Bootstrap.DataAccess.csproj" />
</ItemGroup>

View File

@ -1,6 +1,6 @@
using Bootstrap.Admin.Query;
using Bootstrap.DataAccess;
using Bootstrap.Security;
using Bootstrap.Security.Authentication;
using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

View File

@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Bootstrap.DataAccess;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Bootstrap.Admin
{
@ -22,6 +24,7 @@ namespace Bootstrap.Admin
/// <param name="args"></param>
/// <returns></returns>
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
}
}

View File

@ -6,13 +6,12 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Text.Encodings.Web;
using System.Text.Unicode;
namespace Bootstrap.Admin
{
@ -49,18 +48,22 @@ namespace Bootstrap.Admin
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddLogging(logging => logging.AddFileLogger().AddDBLogger(ExceptionsHelper.Log));
services.AddCors();
//services.AddLogging(builder => builder.AddFileLogger().AddDBLogger(ExceptionsHelper.Log));
services.AddConfigurationManager();
services.AddCacheManager();
services.AddDbAdapter();
services.AddIPLocator(DictHelper.ConfigIPLocator);
services.AddOnlineUsers();
//services.AddSignalR().AddJsonProtocalDefault();
//services.AddSignalRExceptionFilterHandler<SignalRHub>((client, ex) => client.SendMessageBody(ex).ConfigureAwait(false));
services.AddSignalR().AddNewtonsoftJsonProtocol(op =>
{
op.PayloadSerializerSettings.ContractResolver = new DefaultContractResolver();
op.PayloadSerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
});
services.AddSignalRExceptionFilterHandler<SignalRHub>(async (client, ex) => await client.SendMessageBody(ex).ConfigureAwait(false));
services.AddResponseCompression();
services.AddBootstrapAdminAuthentication().AddGitee(OAuthHelper.Configure).AddGitHub(OAuthHelper.Configure);
services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build());
services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireBootstrapAdminAuthorizate().Build());
//services.AddSwagger();
services.AddButtonAuthorization(MenuHelper.AuthorizateButtons);
services.AddBootstrapAdminBackgroundTask();
@ -68,9 +71,13 @@ namespace Bootstrap.Admin
services.AddAdminHealthChecks();
services.AddControllersWithViews(options =>
{
options.Filters.Add<BootstrapAdminAuthorizeFilter>();
options.Filters.Add<ExceptionFilter>();
options.Filters.Add<SignalRExceptionFilter<SignalRHub>>();
}).AddNewtonsoftJson(op =>
{
op.SerializerSettings.ContractResolver = new DefaultContractResolver();
op.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
JsonConvert.DefaultSettings = () => op.SerializerSettings;
});
//services.AddApiVersioning(option =>
//{
@ -107,16 +114,16 @@ namespace Bootstrap.Admin
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseBootstrapAdminAuthentication(RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseBootstrapAdminAuthorization(RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseBootstrapHealthChecks();
app.UseOnlineUsers(TraceHelper.Filter, TraceHelper.Save);
app.UseCacheManager();
//app.UseSwagger(Configuration["SwaggerPathBase"].TrimEnd('/'));
app.UseEndpoints(endpoints =>
{
//endpoints.MapHub<SignalRHub>("/NotiHub");
//endpoints.MapHub<TaskLogHub>("/TaskLogHub");
//endpoints.MapHealthChecks("/healths");
endpoints.MapHub<SignalRHub>("/NotiHub");
endpoints.MapHub<TaskLogHub>("/TaskLogHub");
endpoints.MapHealthChecks("/healths");
endpoints.MapDefaultControllerRoute().RequireAuthorization();
});
}

View File

@ -11,7 +11,6 @@
<PackageReference Include="Longbow.GiteeAuth" Version="2.2.0" />
<PackageReference Include="Longbow.GitHubAuth" Version="2.2.0" />
<PackageReference Include="Longbow.OAuth" Version="2.2.2" />
<PackageReference Include="Longbow.Logging" Version="2.2.13" />
<PackageReference Include="Longbow.PetaPoco" Version="1.0.2" />
<PackageReference Include="Longbow.Security.Cryptography" Version="1.3.0" />
<PackageReference Include="Longbow.Tasks" Version="2.2.23" />