| | |
| | | using DocumentServiceAPI.Core; |
| | | using CSRedis; |
| | | using DocumentServiceAPI.Core; |
| | | using DocumentServiceAPI.Model; |
| | | using DocumentServiceAPI.Services; |
| | | using DocumentServiceAPI.Services.IService; |
| | | using Furion; |
| | | using Mapster; |
| | | using System.Configuration; |
| | | |
| | | namespace DocumentServiceAPI.Web.Entry |
| | | { |
| | |
| | | { |
| | | public void ConfigureServices(IServiceCollection services) |
| | | { |
| | | |
| | | services.AddSqlsugarSetup(); |
| | | var readisconnectionstring = App.Configuration["RedisConfig:ConnectionString"]; |
| | | if (readisconnectionstring != null) |
| | | //初始化redi配置 |
| | | { |
| | | //有配置才注入 |
| | | RedisHelper.Initialization(new CSRedisClient(readisconnectionstring)); |
| | | //注入服务 |
| | | services.AddScoped<IRedisCacheService, RedisCacheScService>(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| | | { |
| | | |
| | | |
| | | app.DbCodeFirst("DocumentServiceAPI.Model"); |
| | | var IsCodeFirst = App.GetConfig<bool>("isCodeFirst"); |
| | | |
| | | if (IsCodeFirst) |
| | | { |
| | | //codefirst 迁徙数据库设置 |
| | | app.DbCodeFirst("DocumentServiceAPI.Model"); |
| | | app.DbCodeFirst(typeof(DocumentServiceAPI.Model.cyDocumentModel.Document_TenderUnit)); |
| | | } |
| | | //启动全局默认映射配置 |
| | | TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true); |
| | | app.UseStaticFiles(new StaticFileOptions |
| | | { |
| | | OnPrepareResponse = (stf) => |
| | |
| | | stf.Context.Response.Headers["Access-Control-Allow-Headers"] = "*"; |
| | | } |
| | | }); |
| | | App.Configuration.Get<WebHostBuilder>().ConfigureKestrel(x => |
| | | { |
| | | x.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(20); |
| | | x.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(20); |
| | | }); |
| | | } |
| | | } |
| | | } |