gpt4 book ai didi

c# - 在 asp.net 和 c# 中上传文件

转载 作者:行者123 更新时间:2023-11-30 22:31:24 24 4
gpt4 key购买 nike

我想知道一些事情。

当我向服务器上传文件时,当文件在 25mb 左右时我可以上传它。当它更多时,看起来响应没有结束,所以它没有上传...

这是我的 webconfig ,在服务器上的时间请求限制是 9999 秒..

<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<sessionState cookieless="false"/>
<httpRuntime maxRequestLength="1048576"/>
</system.web>
<appSettings>
<add key="FolderPath" value="uploads" />
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>

最佳答案

如果您在 IIS 7.0 中托管它,您可能还需要使用 <system.webServer> 增加限制通过设置 maxAllowedContentLength 在您的 web.config 中标记值:

<system.webServer>
<security>
<requestFiltering>
<!-- limit to 100MB -->
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>

默认值为 30000000 字节,大约为 28.6MB

关于c# - 在 asp.net 和 c# 中上传文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9262909/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com