hwh
2024-06-19 3b15b1ceb40e303913f4c396f02aec9838574cc2
Wms/Wms/Startup.cs
@@ -14,6 +14,12 @@
using Wms.Tools;
using WMS.Entity.Context;
using WMS.IBLL.IDataServer;
using Serilog;
using Autofac.Core;
using Utility;
using Utility.Extension;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Http;
namespace Wms
{
@@ -37,7 +43,9 @@
            services.AddHostedService<DailyTaskService>(provider =>
            new DailyTaskService(url,url2));
            services.AddControllers()
            services.AddControllers(options => {
                options.Filters.Add<RequestAuditLogFilter>();
            })
                .AddJsonOptions(options =>
                    {
                        //不使用驼峰样式的key
@@ -110,6 +118,9 @@
            services.AddAutoMapper(typeof(AutoMapperProfile)); // automapper依赖
            #endregion
            //注册serilog
            services.AddConfigSerilog();
            services.AddScoped<ApiResponseActionFilter>();
        }
        public void ConfigureContainer(ContainerBuilder builder)
        {
@@ -133,7 +144,12 @@
                    c.RoutePrefix = string.Empty;
                });
            }
            //全局返回规范
            //app.UseApiResponse();//弃用 改用Filter [ServiceFilter(typeof(ApiResponseActionFilter))]
            app.UseExceptionMiddleware();
            //使用Serilog记录请求日志
            app.UseSerilogRequestLogging();
            //app.UseHttpsRedirection();
            app.UseRouting();
@@ -141,7 +157,6 @@
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseCors("MyCors");//跨域
            app.UseEndpoints(endpoints =>
            {