在 mvc 中将 mp4 文件上传到 Web api 时超出最大大小异常
Maximum size Exceeded exception while uploading mp4 file to web api in mvc
我正在尝试将 mp4 格式文件从其他 api 上传到网络 sharp.But 每次它都给我超过最大文件大小 exception.I 放
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
此代码在我的网络 api 应用程序网络配置文件中,但没有结果。
我正在从其他应用程序调用我的网络 api,因为我使用 Nuget RestShap 来调用网络 api.Please 帮助我。
调用 web api.
的代码
var request = new RestRequest("Uploads", Method.POST);
request.AddFile("filename", Server.MapPath("/Images/videoplayback.mp4"), "multipart/form-data");
request.AddQueryParameter("participantsId", "2");
request.AddQueryParameter("taskId", "77");
request.AddQueryParameter("EnteredAnswerOptionId", "235");
request.AddQueryParameter("lat", "12.15");
request.AddQueryParameter("lon", "12.56");
request.AlwaysMultipartFormData = true;
IRestResponse response = createClient().Execute(request);
如果您的 web.config 中已有此条目,也请添加此条目或添加属性。 executionTimeout 以秒为单位,maxRequestLength 以 KB 为单位。例如 2 小时和 1GB
<system.web>
<httpRuntime executionTimeout="7200" maxRequestLength="1048576" />
</system.web>
我认为你应该参考这些链接,你可能会在这里得到需要的东西...
http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/
我正在尝试将 mp4 格式文件从其他 api 上传到网络 sharp.But 每次它都给我超过最大文件大小 exception.I 放
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
此代码在我的网络 api 应用程序网络配置文件中,但没有结果。 我正在从其他应用程序调用我的网络 api,因为我使用 Nuget RestShap 来调用网络 api.Please 帮助我。 调用 web api.
的代码var request = new RestRequest("Uploads", Method.POST);
request.AddFile("filename", Server.MapPath("/Images/videoplayback.mp4"), "multipart/form-data");
request.AddQueryParameter("participantsId", "2");
request.AddQueryParameter("taskId", "77");
request.AddQueryParameter("EnteredAnswerOptionId", "235");
request.AddQueryParameter("lat", "12.15");
request.AddQueryParameter("lon", "12.56");
request.AlwaysMultipartFormData = true;
IRestResponse response = createClient().Execute(request);
如果您的 web.config 中已有此条目,也请添加此条目或添加属性。 executionTimeout 以秒为单位,maxRequestLength 以 KB 为单位。例如 2 小时和 1GB
<system.web>
<httpRuntime executionTimeout="7200" maxRequestLength="1048576" />
</system.web>
我认为你应该参考这些链接,你可能会在这里得到需要的东西...
http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/