在C#中使用Web客户端时是否有上传限制? [英] Is there an upload limit when using Web Client in C#?
本文介绍了在C#中使用Web客户端时是否有上传限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在WebClient上使用UploadFile("upload.php","POST",filePath)时,任何超过4mb的内容都不会上传.PHP中的限制设置为48mb.我需要在C#中设置吗?
Using UploadFile("upload.php", "POST", filePath) with WebClient anything over 4mb will not upload. The limit in PHP is set at 48mb. Is there I need to set in C# ?
推荐答案
ASP.NET中的默认maxRequestLength设置为4MB,您可以在web.config中对其进行更改.
There is a default maxRequestLength set at 4MB in ASP.NET, you can change it in the web.config.
<configuration>
<system.web>
<!-- This will handle requests up to 1024MB (1GB) -->
<httpRuntime maxRequestLength="1048576" timeout="3600" />
</system.web>
</configuration>
在配置文件中以KB为单位指定长度.如果您使用的是IIS,则IIS会将额外限制设置为4MB.
The length is specified in KB in the config file. If you are using IIS there is an additional limit set at 4MB by IIS.
这篇关于在C#中使用Web客户端时是否有上传限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文