【发布时间】:2015-09-29 02:57:09
【问题描述】:
我创建了一个 Azure Api 应用程序,我将使用它来上传文件。这些文件将> 4mb,因此需要增加最大请求长度。我在 Web.config 中添加了以下内容:
<system.web>
<httpRuntime executionTimeout="7200" targetFramework="4.5" maxRequestLength="2097152" />
</system.web>
我也加了:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2097152000" />
</requestFiltering>
</security>
</system.webServer>
但我仍然收到异常 Maximum request length exceeded.。我错过了什么吗?还有什么我可以尝试的吗?
谢谢!
【问题讨论】:
-
您的
<system.web>部分设置仍为 2 MB,而在<system.webServer>中为 200 MB。 -
@GauravMantri
maxRequestLength以千字节为单位,maxAllowedContentLength以字节为单位。 -
您能分享您使用 API 应用上传文件的方法吗?我正在寻找一种方法来最好地利用 Swagger。
标签: c# api azure file-upload azure-api-apps