qwj
2023-08-03 fbf108da3ebb58b28ed57faaf912831ce03a5dff
修改启动配置,上传文件大小限制
2个文件已修改
16 ■■■■■ 已修改文件
DocumentFile.Service/DocumentFile.Service.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentFile.Service/Program.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DocumentFile.Service/DocumentFile.Service.csproj
@@ -4,6 +4,7 @@
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
DocumentFile.Service/Program.cs
@@ -12,13 +12,14 @@
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.WebHost.UseKestrel(options =>
{
    //options.Limits.MaxRequestLineSize = int.MaxValue;//HTTP 请求行的最大允许大小。 默认为 8kb
    //options.Limits.MaxRequestBufferSize = int.MaxValue;//请求缓冲区的最大大小。 默认为 1M
    //任何请求正文的最大允许大小(以字节为单位),默认 30,000,000 字节,大约为 28.6MB
    options.Limits.MaxRequestBodySize = 300 * 1024 * 1024; //限制请求长度
});
//builder.WebHost.UseKestrel(options =>
//{
//配置了这个IIS上不能运行
//    //options.Limits.MaxRequestLineSize = int.MaxValue;//HTTP 请求行的最大允许大小。 默认为 8kb
//    //options.Limits.MaxRequestBufferSize = int.MaxValue;//请求缓冲区的最大大小。 默认为 1M
//    //任何请求正文的最大允许大小(以字节为单位),默认 30,000,000 字节,大约为 28.6MB
//    options.Limits.MaxRequestBodySize = 300 * 1024 * 1024; //限制请求长度
//});
builder.Services.Configure<FormOptions>(options =>
{
    //默认上传大小限制