使用MVC Web API方法从Windows phone 8应用程序上传大文件不工作

本文关键字:程序上 应用程序 文件 工作 应用 API Web MVC 方法 phone Windows | 更新日期: 2023-09-27 18:17:16

我正在尝试从我的Windows phone 8应用程序之一上传文件。我们正在使用MVC4 web API,它工作得很好,除非文件大小小于5 MB。任何超过5 MB的文件都会给我404(未找到)响应。

我认为从API方面没有问题,因为我能够使用Fiddler上传相同的文件而没有错误。

我使用HttpClient向服务发送请求。

任何帮助都将是非常感激的。

Vinod

使用MVC Web API方法从Windows phone 8应用程序上传大文件不工作

尝试在web中增加MaxRequestSize。配置MVC站点

<configuration>
   <system.web>
     <httpRuntime maxRequestLength="10240" />
   </system.web>
 </configuration>

在IIS 7+中试试这个

 <system.webServer>
   <security>
     <requestFiltering>
         <requestLimits maxAllowedContentLength="52428800" /> <!--50MB-->
     </requestFiltering>
   </security>
 </system.webServer>

只需在web中进行这些更改。配置文件:

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="2147483647" />
  </requestFiltering>
</security>
...

相关文章: