From 376bb6cf439eaa3b2867825fe22a14e381dd9213 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 14 八月 2024 17:55:48 +0800
Subject: [PATCH] 1.新增工序找设备(工位)接口 2.新增物料清单查询、新增、修改接口

---
 VueWebCoreApi/Startup.cs |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/VueWebCoreApi/Startup.cs b/VueWebCoreApi/Startup.cs
index eb7aa03..863b384 100644
--- a/VueWebCoreApi/Startup.cs
+++ b/VueWebCoreApi/Startup.cs
@@ -7,9 +7,11 @@
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http.Connections;
+using Microsoft.AspNetCore.Http.Features;
 using Microsoft.AspNetCore.HttpsPolicy;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc.Authorization;
+using Microsoft.AspNetCore.Server.Kestrel.Core;
 using Microsoft.AspNetCore.StaticFiles;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
@@ -122,6 +124,19 @@
             //设置Cookies
             services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
 
+            #region 允许大文件上传
+            //允许上传大文件
+            services.Configure<IISServerOptions>(options =>
+            {
+                options.MaxRequestBodySize = 1073741824;//此处限制最大1G  
+            });
+            //解决文件上传Multipart body length limit 134217728 exceeded.
+            services.Configure<FormOptions>(x =>
+            {
+                x.ValueLengthLimit = int.MaxValue;
+                x.MultipartBodyLengthLimit = 1073741824; //此处限制最大1G  
+            });
+            #endregion 允许大文件上传
         }
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLeftTime, ILoggerFactory loggerFactory)
@@ -157,13 +172,15 @@
             //添加静态文件中间件
             app.UseDefaultFiles();
             //添加授权文件
-            app.UseStaticFiles(new StaticFileOptions() { 
-                ContentTypeProvider = new FileExtensionContentTypeProvider() { 
+            app.UseStaticFiles(new StaticFileOptions()
+            {
+                ContentTypeProvider = new FileExtensionContentTypeProvider()
+                {
                     Mappings = {
-                        [".xls"] = "application/vnd.ms-excel", 
+                        [".xls"] = "application/vnd.ms-excel",
                         [".apk"] = "application/vnd.android.package-archive"
-                    } 
-                } 
+                    }
+                }
             });
             app.UseStaticFiles();
             //跨域

--
Gitblit v1.9.3