代码拉取完成,页面将自动刷新
同步操作将从 依然/yiran 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading.Tasks;
using log4net;
using log4net.Config;
using log4net.Repository;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using UEditorNetCore;
using yiran.Areas.Admin.Service;
using yiran.Log;
using yiran.Services;
namespace yiran
{
public class Startup
{
/// <summary>
/// log4net 仓储库
/// </summary>
public static ILoggerRepository repository { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddResponseCompression();
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddSession(options => {
options.IdleTimeout = TimeSpan.FromMinutes(120);
});
services.AddUEditorService();
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
services.AddControllersWithViews(c=> {
c.Filters.Add(typeof(GlobalExceptionFilter));
}).AddRazorRuntimeCompilation();
//log4net
repository = LogManager.CreateRepository("yiran");//需要获取日志的仓库名,也就是你的当然项目名
//指定配置文件,如果这里你遇到问题,应该是使用了InProcess模式,请查看Blog.Core.csproj,并删之
XmlConfigurator.Configure(repository, new FileInfo("log4net.config"));//配置文件
services.AddSingleton<ILoggerHelper, LogHelper>();
#region 网站前台服务
services.AddScoped<HomeService>();
#endregion
#region 网站后台服务
services.AddScoped<sys_loginService>(); //登录
services.AddScoped<sys_RoleService>(); //权限
services.AddScoped<sys_HomePageService>(); //首页管理
services.AddScoped<sys_FormService>(); //表单管理
services.AddScoped<sys_WebService>(); //网站相关设置
services.AddScoped<sys_ProductService>(); //产品管理
#endregion
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseStatusCodePagesWithReExecute("/Home/Error");
}
app.UseResponseCompression();
app.UseRouting();
app.UseStaticFiles();
app.UseSession();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "areas",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。