Request Entity Too Large for Self Hosted ASP.Net Web API在Selfhost的api后台怎么解决Request Entity Too Large问题
2024-10-18 23:26:23
Request Entity Too Large for Self Hosted ASP.Net Web API在Selfhost的api后台怎么解决Request Entity Too Large问题
如果用的IIS承载api,可以在web.config中添加配置来解决
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
<httpRuntime
maxRequestLength=""
executionTimeout="" />
</system.web>
但在Selfhost中App.config没办法添加此配置
正常的添加方法应该在添加selfhost绑定配置项时添加
var config = new HttpSelfHostConfiguration(host);
config.MaxReceivedMessageSize = ; // use config for this value
/*
other setup for the config
*/
using (var server = new HttpSelfHostServer(config))
{
server.OpenAsync().Wait();
Console.WriteLine("Insight.Web");
Console.ReadLine();
}
最新文章
- MySQL开启慢查询 总结
- 20145212 《Java程序设计》第7周学习总结
- iOS 使用COPY声明NSSTRING属性
- 命令cd
- 安全管理:IE6安全隐患重重 为何不离不弃
- opencv实现连通域
- 转:Web 测试的创作与调试技术
- Shiro眼皮下玩ajax,玩出302 Found(实践得经验)
- 瑞芯微RKnanC芯片处理器介绍
- 【常见错误】--Nltk使用错误
- Dubbo常用配置解析
- mysql5.7基于gtid主从重做
- npm 命令
- Centos rpm包安装PHP所需包
- PXE:偷梁换柱,成功 启动 centos live
- 二分查找、two points、排序
- 022 Spark shuffle过程
- easyui confirm提示框 调整显示位置
- LeetCode 112 Minimum Depth of Binary Tree
- Qt解析Json数据