![](/img/trans.png)
[英]Update configuration and restart self-hosted ASP.NET Web API 2 on HTTP request
[英]Request Entity Too Large for Self Hosted ASP.Net Web API
我有一大塊json需要發布到自托管的ASP.Net Web API服務。
我收到“ 狀態代碼:413請求實體太大 ”消息。
試圖將以下內容放在webapi服務項目的app.config中。
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
<httpRuntime
maxRequestLength="2147483647"
executionTimeout="300" />
</system.web>
這沒有用。
我正在考慮以下兩個選項。
我更喜歡第二種選擇 ,但尚未找到如何實現它。
有什么指針嗎?
我遇到了同樣的問題,並且能夠在代碼中進行更改。
var config = new HttpSelfHostConfiguration(host);
config.MaxReceivedMessageSize = 2147483647; // 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();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.