我在.Net中上传大文件时遇到了麻烦
我尝试了几个参考但无济于事 . 第一个问题是在上传文件时遇到错误404,我尝试增加请求限制maxAllowedContentLength和maxRequestLength来解决问题 . 没有错误404.但是,我仍然无法上传超过40Mb的文件 . 在Fiddler中没有记录 endpoints 调用,甚至在Visual Studio中都没有显示错误或异常 .
这是我的web.config的一部分:
<system.web>
<!-- Setting maxRequestLength to be much greater than default 4096 so that large data may be uploaded e.g. images, docs -->
<httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" maxRequestLength="204800000" executionTimeout="3600" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral>
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="2200000000" />
</requestFiltering>
</security>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding maxReceivedMessageSize="6553600" />
</webHttpBinding>
</bindings>
</system.serviceModel>
任何帮助,将不胜感激 . 谢谢