| | |
| | | using Serilog; |
| | | using Autofac.Core; |
| | | using Utility; |
| | | using Utility.Extension; |
| | | using Microsoft.Extensions.Options; |
| | | using Microsoft.AspNetCore.Http; |
| | | using SqlSugar; |
| | |
| | | var url2 = Configuration.GetSection("ApiUrlConfig:AgvHost").Value + Configuration.GetSection("ApiUrlConfig:IssueComApiUrl").Value; |
| | | //调用定时任务 |
| | | services.AddHostedService<DailyTaskService>(provider => |
| | | new DailyTaskService(url,url2)); |
| | | new DailyTaskService(url, url2)); |
| | | |
| | | services.AddControllers(options => { |
| | | services.AddControllers(options => |
| | | { |
| | | options.Filters.Add<RequestAuditLogFilter>(); |
| | | options.Filters.Add<CustomerExceptionFilter>(); |
| | | }) |
| | | .AddJsonOptions(options => |
| | | { |
| | |
| | | .SetIsOriginAllowed(_ => true) |
| | | .AllowAnyHeader() |
| | | .AllowCredentials(); |
| | | |
| | | |
| | | }); |
| | | }); |
| | | #endregion |
| | |
| | | #endregion |
| | | |
| | | //读取配置文件配置的接口交互的相关配置 |
| | | services.Configure<ApiUrlConfig>(Configuration.GetSection("ApiUrlConfig")); |
| | | services.Configure<ApiUrlConfig>(Configuration.GetSection("ApiUrlConfig")); |
| | | //数据库配置 |
| | | BaseDbConfig.ConnectionString = Configuration.GetSection("AppSettings:ConnectionString").Value; |
| | | //验签配置文件 |
| | | SignConfig.ERPAppKey = Configuration.GetSection("SignConfig:ERPAppKey").Value; |
| | | SignConfig.MESAppKey = Configuration.GetSection("SignConfig:MESAppKey").Value; |
| | | SignConfig.LIMSAppKey = Configuration.GetSection("SignConfig:LIMSAppKey").Value; |
| | | SignConfig.ERPAppKey = Configuration.GetSection("SignConfig:ERPAppKey").Value; |
| | | SignConfig.MESAppKey = Configuration.GetSection("SignConfig:MESAppKey").Value; |
| | | SignConfig.LIMSAppKey = Configuration.GetSection("SignConfig:LIMSAppKey").Value; |
| | | SignConfig.FuMaAppKey = Configuration.GetSection("SignConfig:FuMaAppKey").Value; |
| | | SignConfig.Minutes = double.Parse(Configuration.GetSection("SignConfig:Minutes").Value); |
| | | |
| | |
| | | |
| | | services.AddHostedService<HostedService>(); |
| | | services.AddSingleton<SchedulerCenter>(); |
| | | |
| | | services.AddTransient<UserManager>(); |
| | | services.AddTransient<IHttpContextAccessor, HttpContextAccessor>(); |
| | | } |
| | | public void ConfigureContainer(ContainerBuilder builder) |
| | | { |
| | |
| | | } |
| | | //全局返回规范 |
| | | //app.UseApiResponse();//弃用 改用Filter [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | app.UseExceptionMiddleware(); |
| | | |
| | | //使用Serilog记录请求日志 |
| | | app.UseSerilogRequestLogging(); |
| | | //app.UseHttpsRedirection(); |
| | | |
| | | app.UseRouting(); |
| | | |
| | | |
| | | app.UseAuthentication(); |
| | | app.UseAuthorization(); |
| | | app.UseCors("MyCors");//跨域 |