当前位置:网站首页>In ASP.NET Core 2.0, solve the configuration problem of large file upload
In ASP.NET Core 2.0, solve the configuration problem of large file upload
2022-08-08 10:02:00 【Drinking Water Siyuan 09】
In .net core 2.0, when the uploaded file is larger than 30MB, it will report: Request filtering on the server is configured to reject the request because the content length exceeds the configured value.
The solution to this problem is as follows:
1), add the following code in Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
//Configuration file size limit 1GB
services.Configure
{
options.ValueLengthLimit = 1073741824;
options.MultipartBodyLengthLimit = 1073741824;
});
//........
}
2), add the following code before the specific method:
///
/// Upload attachments
///
///
[RequestSizeLimit(1073741824)]
, string projectId, string stage_id)
{
//......
} }
3), add a web.config file to the project, the specific code is as follows:
/system.webServer>
The problems reported in the system can be solved through the above three steps: The request screening module is configured to reject requests exceeding the length of the requested content. This is asecurity function.Please do not change this feature unless you are fully aware of the scope of the change.You can configure the IIS server to reject requests with a content length greater than a specified value.This error is returned if the requested content length is greater than the configured length.Increase the content length if needed.
边栏推荐
- 面试突击72:输入URL之后会执行什么流程?
- Interviewer: Have you ever used a lock at work?Talk about the advantages, disadvantages and usage scenarios of optimistic locking and pessimistic locking
- 播放器的一些改进
- Redis 定长队列的探索和实践
- 小散量化炒股记|打包Py可执行文件,双击就能选出全市场稳步上扬的股票
- go web之响应用户
- 五、业务数据分析
- VPP静态映射实现DNAT
- PHP 手机号脱敏,正则表达式/简易版
- 2万字50张图玩转Flink面试体系
猜你喜欢
COMSOL Multiphysics 6.0软件安装包和安装教程
交换两个整型变量的三种方法
【AGC】开放式测试示例
VMWare Esxi 虚拟系统数据存储扩容(增加容量)的简明教程
Redis 定长队列的探索和实践
Multi-scalar multiplication: state of the art & new ideas
"Inversion of Control" and "Dependency Inversion", can't you tell the difference?
Vulnhub靶机:GEMINI INC_ 1
1252_FreeRTOS_堆栈溢出检查方法与测试
牛客收藏上万的神作!这份阿里P8手写的MySQL主从原理手册真的牛
随机推荐
Code implementation of various kinds of attention
2万字50张图玩转Flink面试体系
hdu4635 Strongly connected(tarjan计算强连通通分量+缩点+思想)
正向传播和反向传播
图像分割 总结
Mysql数据库架构介绍
VPP源地址NAT
一、用户数据仓库
VPP静态映射实现DNAT
To make people's consumption safer, more assured and more satisfied
实战案例:用 PySpark ML 构建流失预测模型
利用图像二维熵实现视频信号丢失检测(Signal Loss Detection)
The keys of the Flutter storage database
Multi-scalar multiplication: state of the art & new ideas
2022世界机器人大会即将举办,智能机器人助推传统行业向智能化、数字化转型升级
Redis 定长队列的探索和实践
文档数据库于键值数据库有什么不同吗?
mysql-cdc 换2.2.x 版本 怎么读不到 数据 咋回事
flink sql创建表成功,查询却报错block data,大家有没有碰到这现象
PHP 手机号脱敏,正则表达式/简易版