将项目升级到.net core 3.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="NewLife.Core" Version="8.3.2019.822" />
|
<PackageReference Include="NewLife.Core" Version="8.3.2019.923" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
|
||||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ namespace COMCMS.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 程序绝对目录
|
/// 程序绝对目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string _ContentRootPath = DI.ServiceProvider.GetService<IHostingEnvironment>().ContentRootPath;
|
private static string _ContentRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().ContentRootPath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 静态文件
|
/// 静态文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string _WebRootPath = DI.ServiceProvider.GetService<IHostingEnvironment>().WebRootPath;
|
private static string _WebRootPath = DI.ServiceProvider.GetService<IWebHostEnvironment>().WebRootPath;
|
||||||
|
|
||||||
#region 方式
|
#region 方式
|
||||||
public enum CutMode
|
public enum CutMode
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.822" />
|
<PackageReference Include="NewLife.XCode" Version="9.14.2019.923" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -184,8 +184,8 @@ namespace COMCMS.Core
|
|||||||
{
|
{
|
||||||
if (IsAdminLogin())
|
if (IsAdminLogin())
|
||||||
{
|
{
|
||||||
//return Find(_.UserName == SessionHelper.GetSession(sessionAdminNameKey).ToString());
|
return Find(_.UserName == SessionHelper.GetSession(sessionAdminNameKey).ToString());
|
||||||
return Find(_.UserName == AuthenticationHelper.GetClaim(sessionAdminNameKey));
|
//return Find(_.UserName == AuthenticationHelper.GetClaim(sessionAdminNameKey));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -241,8 +241,8 @@ namespace COMCMS.Core
|
|||||||
//写入Session 和 Cookies
|
//写入Session 和 Cookies
|
||||||
//SessionHelper.WriteSession("rtadminguid", GUID.ToString());
|
//SessionHelper.WriteSession("rtadminguid", GUID.ToString());
|
||||||
//CookiesHelper.WriteCookie("rtadminguid", GUID.ToString(), 120);
|
//CookiesHelper.WriteCookie("rtadminguid", GUID.ToString(), 120);
|
||||||
//SetAdminInfo(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt);
|
SetAdminInfo(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt);
|
||||||
SetAdminInfoAsync(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt).Wait();
|
//SetAdminInfoAsync(entity.UserName, entity.PassWord, entity.Id, 0, "", GUID.ToString(), entity.Salt).Wait();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -255,22 +255,22 @@ namespace COMCMS.Core
|
|||||||
/// <returns>是否登录</returns>
|
/// <returns>是否登录</returns>
|
||||||
public static bool IsAdminLogin()
|
public static bool IsAdminLogin()
|
||||||
{
|
{
|
||||||
//string adminName = SessionHelper.GetSession(sessionAdminNameKey).ToString();//用户名
|
string adminName = SessionHelper.GetSession(sessionAdminNameKey).ToString();//用户名
|
||||||
//string adminID = SessionHelper.GetSession(sessionAdminIDKey).ToString();//ID
|
string adminID = SessionHelper.GetSession(sessionAdminIDKey).ToString();//ID
|
||||||
string adminName = AuthenticationHelper.GetClaim(sessionAdminNameKey);//用户名
|
//string adminName = AuthenticationHelper.GetClaim(sessionAdminNameKey);//用户名
|
||||||
string adminID = AuthenticationHelper.GetClaim(sessionAdminIDKey);//ID
|
//string adminID = AuthenticationHelper.GetClaim(sessionAdminIDKey);//ID
|
||||||
|
|
||||||
//如果Session失效,则用Cookies判断
|
//如果Session失效,则用Cookies判断
|
||||||
if (string.IsNullOrEmpty(adminName) || string.IsNullOrEmpty(adminID))
|
if (string.IsNullOrEmpty(adminName) || string.IsNullOrEmpty(adminID))
|
||||||
{
|
{
|
||||||
//string cooAdminName = CookiesHelper.GetCookie(cookiesAdminNameKey);//用户名
|
string cooAdminName = CookiesHelper.GetCookie(cookiesAdminNameKey);//用户名
|
||||||
//string cooAdminID = CookiesHelper.GetCookie(cookiesAdminIDKey);//ID
|
string cooAdminID = CookiesHelper.GetCookie(cookiesAdminIDKey);//ID
|
||||||
//string cooLoginInfo = CookiesHelper.GetCookie(cookiesAdminInfoKey);//信息
|
string cooLoginInfo = CookiesHelper.GetCookie(cookiesAdminInfoKey);//信息
|
||||||
//string cooAdminLogID = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
string cooAdminLogID = CookiesHelper.GetCookie(cookiesAdminLogIDKey);//日志GUID
|
||||||
string cooAdminName = AuthenticationHelper.GetClaim(cookiesAdminNameKey);//用户名
|
//string cooAdminName = AuthenticationHelper.GetClaim(cookiesAdminNameKey);//用户名
|
||||||
string cooAdminID = AuthenticationHelper.GetClaim(cookiesAdminIDKey);//ID
|
//string cooAdminID = AuthenticationHelper.GetClaim(cookiesAdminIDKey);//ID
|
||||||
string cooLoginInfo = AuthenticationHelper.GetClaim(cookiesAdminInfoKey);//信息
|
//string cooLoginInfo = AuthenticationHelper.GetClaim(cookiesAdminInfoKey);//信息
|
||||||
string cooAdminLogID = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
//string cooAdminLogID = AuthenticationHelper.GetClaim(cookiesAdminLogIDKey);//日志GUID
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(cooAdminID) || string.IsNullOrEmpty(cooAdminName) || string.IsNullOrEmpty(cooLoginInfo) || string.IsNullOrEmpty(cooAdminLogID))
|
if (string.IsNullOrEmpty(cooAdminID) || string.IsNullOrEmpty(cooAdminName) || string.IsNullOrEmpty(cooLoginInfo) || string.IsNullOrEmpty(cooAdminLogID))
|
||||||
{
|
{
|
||||||
@@ -298,16 +298,16 @@ namespace COMCMS.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
//重新写入Session 和 Cookies
|
//重新写入Session 和 Cookies
|
||||||
//SetAdminInfo(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt);
|
SetAdminInfo(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt);
|
||||||
|
|
||||||
SetAdminInfoAsync(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt).Wait();
|
//SetAdminInfoAsync(model.UserName, model.PassWord, model.Id, 0, "", cooAdminLogID, model.Salt).Wait();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//ClearInfo();//清除信息
|
ClearInfo();//清除信息
|
||||||
ClearInfoAsync().Wait();
|
//ClearInfoAsync().Wait();
|
||||||
return false;//信息错误
|
return false;//信息错误
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
[Area("AdminCP")]
|
[Area("AdminCP")]
|
||||||
public class IndexController : AdminBaseController
|
public class IndexController : AdminBaseController
|
||||||
{
|
{
|
||||||
private readonly IHostingEnvironment _env;
|
private readonly IWebHostEnvironment _env;
|
||||||
public IndexController(IHostingEnvironment env)
|
public IndexController(IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
_env = env;
|
_env = env;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IActionResult Logout()
|
public IActionResult Logout()
|
||||||
{
|
{
|
||||||
//Admin.ClearInfo();
|
Admin.ClearInfo();
|
||||||
Admin.ClearInfoAsync().Wait();
|
//Admin.ClearInfoAsync().Wait();
|
||||||
return Redirect("~/AdminCP/Login");
|
return Redirect("~/AdminCP/Login");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
[Area("AdminCP")]
|
[Area("AdminCP")]
|
||||||
public class SystemController : AdminBaseController
|
public class SystemController : AdminBaseController
|
||||||
{
|
{
|
||||||
private IHostingEnvironment _env;
|
private IWebHostEnvironment _env;
|
||||||
public SystemController(IHostingEnvironment env)
|
public SystemController(IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
_env = env;
|
_env = env;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ using COMCMS.Core.Models;
|
|||||||
using System.DrawingCore;
|
using System.DrawingCore;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http.Internal;
|
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using NewLife.UserGroup.WebUploader;
|
using NewLife.UserGroup.WebUploader;
|
||||||
|
|
||||||
@@ -47,9 +46,9 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
public class UploadController : AdminBaseController
|
public class UploadController : AdminBaseController
|
||||||
{
|
{
|
||||||
private readonly SystemSetting _attachsetting;
|
private readonly SystemSetting _attachsetting;
|
||||||
private IHostingEnvironment _env;
|
private IWebHostEnvironment _env;
|
||||||
private AttachConfigEntity attach;
|
private AttachConfigEntity attach;
|
||||||
public UploadController(IHostingEnvironment env, IOptions<SystemSetting> attachsetting)
|
public UploadController(IWebHostEnvironment env, IOptions<SystemSetting> attachsetting)
|
||||||
{
|
{
|
||||||
attach = Config.GetSystemConfig().AttachConfigEntity;
|
attach = Config.GetSystemConfig().AttachConfigEntity;
|
||||||
_env = env;
|
_env = env;
|
||||||
@@ -424,7 +423,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
var req = HttpContext.Request;
|
var req = HttpContext.Request;
|
||||||
var f = Request.Form.Files[0];
|
var f = Request.Form.Files[0];
|
||||||
|
|
||||||
Request.EnableRewind();
|
//Request.EnableRewind();
|
||||||
Image image = null;
|
Image image = null;
|
||||||
using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
|
using (StreamReader reader = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<select class="form-control m-b" name="KId" id="KId">
|
<select class="form-control m-b" name="KId" id="KId">
|
||||||
@foreach (var m in ViewBag.ListKinds)
|
@foreach (var m in ViewBag.ListKinds)
|
||||||
{
|
{
|
||||||
<option value="@m.Id" @(ViewBag.lastkid == m.Id?"selected":"")>@m.KindName</option>
|
<option value="@m.Id">@m.KindName</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MailKit" Version="2.3.1.6" />
|
<PackageReference Include="MailKit" Version="2.3.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App"/>
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
|
||||||
<PackageReference Include="MimeKit" Version="2.3.1" />
|
<PackageReference Include="MimeKit" Version="2.3.2" />
|
||||||
<PackageReference Include="MySql.Data" Version="8.0.17" />
|
<PackageReference Include="MySql.Data" Version="8.0.18" />
|
||||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.822" />
|
<PackageReference Include="NewLife.XCode" Version="9.14.2019.923" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="Senparc.Weixin" Version="6.4.13" />
|
<PackageReference Include="Senparc.Weixin" Version="6.6.102" />
|
||||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.7.17" />
|
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.102" />
|
||||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.4.5" />
|
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.102" />
|
||||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.5.4" />
|
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.102" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
|
<PackageReference Include="System.Data.SqlClient" Version="4.7.0" />
|
||||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace COMCMS.Web.Common
|
|||||||
{
|
{
|
||||||
public class HttpGlobalExceptionFilter : IExceptionFilter
|
public class HttpGlobalExceptionFilter : IExceptionFilter
|
||||||
{
|
{
|
||||||
readonly IHostingEnvironment _env;
|
readonly IWebHostEnvironment _env;
|
||||||
public HttpGlobalExceptionFilter(IHostingEnvironment env)
|
public HttpGlobalExceptionFilter(IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
_env = env;
|
_env = env;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace COMCMS.Web.Configuration
|
|||||||
{
|
{
|
||||||
public class JsonOptionsConfig
|
public class JsonOptionsConfig
|
||||||
{
|
{
|
||||||
public static void ConfigJsonOptions(MvcJsonOptions options)
|
public static void ConfigJsonOptions(MvcNewtonsoftJsonOptions options)
|
||||||
{
|
{
|
||||||
var settings = options.SerializerSettings;
|
var settings = options.SerializerSettings;
|
||||||
//日期类型默认格式化处理
|
//日期类型默认格式化处理
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace COMCMS.Web
|
namespace COMCMS.Web
|
||||||
@@ -14,12 +15,14 @@ namespace COMCMS.Web
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BuildWebHost(args).Run();
|
CreateHostBuilder(args).Build().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHost BuildWebHost(string[] args) =>
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.UseStartup<Startup>()
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
.Build();
|
{
|
||||||
|
webBuilder.UseStartup<Startup>();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-36
@@ -4,31 +4,28 @@ using System.Linq;
|
|||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Unicode;
|
using System.Text.Unicode;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using COMCMS.Common;
|
||||||
|
using COMCMS.Web.Common;
|
||||||
|
using COMCMS.Web.ExceptionHandler;
|
||||||
|
using COMCMS.Web.Models;
|
||||||
|
using Lib.Core.MiddlewareExtension.Extension;
|
||||||
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.WebEncoders;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using COMCMS.Common;
|
|
||||||
using COMCMS.Web.Models;
|
|
||||||
using COMCMS.Web.Common;
|
|
||||||
using COMCMS.Web.ExceptionHandler;
|
|
||||||
using Lib.Core.MiddlewareExtension.Extension;
|
|
||||||
using Senparc.Weixin.Entities;
|
|
||||||
using Senparc.CO2NET;
|
|
||||||
using Senparc.CO2NET.RegisterServices;
|
|
||||||
using Senparc.Weixin;
|
|
||||||
using Senparc.CO2NET.Cache;
|
|
||||||
using System.Configuration;
|
|
||||||
using COMCMS.Web.Configuration;
|
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Microsoft.Extensions.WebEncoders;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
using Senparc.CO2NET;
|
||||||
|
using Senparc.CO2NET.Cache;
|
||||||
|
using Senparc.CO2NET.RegisterServices;
|
||||||
|
using Senparc.Weixin.Entities;
|
||||||
using Senparc.Weixin.RegisterServices;
|
using Senparc.Weixin.RegisterServices;
|
||||||
using Microsoft.AspNetCore.Routing.Constraints;
|
|
||||||
|
|
||||||
namespace COMCMS.Web
|
namespace COMCMS.Web
|
||||||
{
|
{
|
||||||
@@ -75,13 +72,12 @@ namespace COMCMS.Web
|
|||||||
services.Configure<SystemSetting>(Configuration.GetSection("SystemSetting"));
|
services.Configure<SystemSetting>(Configuration.GetSection("SystemSetting"));
|
||||||
|
|
||||||
services
|
services
|
||||||
.AddMvc(options =>
|
.AddControllersWithViews(options =>
|
||||||
{
|
{
|
||||||
//记录错误
|
//记录错误
|
||||||
options.Filters.Add<HttpGlobalExceptionFilter>();
|
options.Filters.Add<HttpGlobalExceptionFilter>();
|
||||||
})
|
})
|
||||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
|
.AddNewtonsoftJson(options =>options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver());
|
||||||
.AddJsonOptions(JsonOptionsConfig.ConfigJsonOptions);
|
|
||||||
|
|
||||||
//防止汉字被自动编码
|
//防止汉字被自动编码
|
||||||
services.Configure<WebEncoderOptions>(options =>
|
services.Configure<WebEncoderOptions>(options =>
|
||||||
@@ -96,22 +92,27 @@ namespace COMCMS.Web
|
|||||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||||
|
|
||||||
// 设置表单内容限制
|
// 设置表单内容限制
|
||||||
services.Configure<FormOptions>(formOptions =>
|
//services.Configure<FormOptions>(options =>
|
||||||
{
|
//{
|
||||||
formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
// //formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte
|
||||||
formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
// //formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728
|
||||||
});
|
// options.ValueCountLimit = int.MaxValue;
|
||||||
|
// options.ValueLengthLimit = int.MaxValue;
|
||||||
|
// options.KeyLengthLimit = int.MaxValue;
|
||||||
|
// options.MultipartBodyLengthLimit = int.MaxValue;
|
||||||
|
// options.MultipartBoundaryLengthLimit = int.MaxValue;
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider svp, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider svp, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||||
{
|
{
|
||||||
app.Use(async (context, next) =>
|
app.Use(async (context, next) =>
|
||||||
{
|
{
|
||||||
context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -134,25 +135,26 @@ namespace COMCMS.Web
|
|||||||
app.UseCookiePolicy();
|
app.UseCookiePolicy();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
app.UseStaticHttpContext();
|
app.UseStaticHttpContext();
|
||||||
|
app.UseRouting();
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "areas",
|
name: "areas",
|
||||||
template: "{area:exists}/{controller=Index}/{action=Index}/{id?}"
|
pattern: "{area:exists}/{controller=Index}/{action=Index}/{id?}"
|
||||||
);
|
);
|
||||||
|
|
||||||
routes.MapRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
routes.MapRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "article",
|
name: "article",
|
||||||
template: "{title}/index.html",
|
pattern: "{title}/index.html",
|
||||||
defaults: new { controller = "Home", action = "Article" }
|
defaults: new { controller = "Home", action = "Article" }
|
||||||
);
|
);
|
||||||
routes.MapRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "article2",
|
name: "article2",
|
||||||
template: "{title}/",
|
pattern: "{title}/",
|
||||||
defaults: new { controller = "Home", action = "Article" }
|
defaults: new { controller = "Home", action = "Article" }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台
|
|||||||
|
|
||||||
### 技术简要
|
### 技术简要
|
||||||
|
|
||||||
- .net core 2.1.6 (请注意升级本地SDK 或者runtime)
|
- .net core 3.0 (请注意升级本地SDK 或者runtime)
|
||||||
- 数据库:Mysql 5.7 /Mysql 8.0
|
- 数据库:Mysql 5.7 /Mysql 8.0
|
||||||
- ORM:数据库操作使用XCode,目前支持mysql、sqlserver。详细见:https://github.com/NewLifeX/X
|
- ORM:数据库操作使用XCode,目前支持mysql、sqlserver。详细见:https://github.com/NewLifeX/X
|
||||||
- 据库驱动使用:MySQL官方驱动,8.0.13
|
- 据库驱动使用:MySQL官方驱动,8.0.19
|
||||||
- 后台模板是H+
|
- 后台模板是H+
|
||||||
- 编辑器采用CKeditor 支持截图粘贴进去,上传图片采用webuploader
|
- 编辑器采用CKeditor 支持截图粘贴进去,上传图片采用webuploader
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台
|
|||||||
|
|
||||||
- NewLife.UserGroup.WebUploader 大文件上传
|
- NewLife.UserGroup.WebUploader 大文件上传
|
||||||
|
|
||||||
- WebTest 测试站点
|
- WebTest 测试站点;暂时屏蔽
|
||||||
|
|
||||||
- data 目录是初始化sql ,目前是mysql
|
- data 目录是初始化sql ,目前是mysql
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
<#
|
<#
|
||||||
// 设置当前工作目录
|
// 设置当前工作目录
|
||||||
PathHelper.BaseDirectory = Host.ResolvePath(".");
|
PathHelper.BaseDirectory = Host.ResolvePath(".");
|
||||||
// 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名
|
// 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名
|
||||||
|
//EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true);
|
||||||
EntityBuilder.Build();
|
EntityBuilder.Build();
|
||||||
|
|
||||||
//var tables = DAL.ImportFrom("Company.Project.xml");
|
//var tables = DAL.ImportFrom("Company.Project.xml");
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="NewLife.Core, Version=8.3.7173.39564, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="NewLife.Core, Version=8.3.7207.798, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NewLife.Core.8.3.2019.822\lib\net45\NewLife.Core.dll</HintPath>
|
<HintPath>..\packages\NewLife.Core.8.3.2019.923\lib\net46\NewLife.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -46,8 +46,8 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="XCode, Version=9.14.7173.39578, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="XCode, Version=9.14.7207.834, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NewLife.XCode.9.14.2019.822\lib\net45\XCode.dll</HintPath>
|
<HintPath>..\packages\NewLife.XCode.9.14.2019.923\lib\net46\XCode.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="NewLife.Core" version="8.3.2019.822" targetFramework="net461" />
|
<package id="NewLife.Core" version="8.3.2019.923" targetFramework="net461" />
|
||||||
<package id="NewLife.XCode" version="9.14.2019.822" targetFramework="net461" />
|
<package id="NewLife.XCode" version="9.14.2019.923" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user