From 8747c355e51d09473efd30107e18303bb092a1ad Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 16 八月 2024 14:31:48 +0800
Subject: [PATCH] 1.新增工单新增、编辑时通过产品找物料清单接口 2、修改工单新增、编辑接口(通过bom计算工单用料清单)
---
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