惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
GRAHAM CLULEY
博客园_首页
博客园 - Franky
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cisco Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
F
Full Disclosure
Cloudbric
Cloudbric
J
Java Code Geeks
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
The Hacker News
The Hacker News
量子位
T
The Blog of Author Tim Ferriss
T
Threatpost
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
T
Threat Research - Cisco Blogs
Project Zero
Project Zero
Scott Helme
Scott Helme
N
Netflix TechBlog - Medium
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tenable Blog
S
Schneier on Security
T
Tor Project blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Heimdal Security Blog
T
Tailwind CSS Blog
P
Privacy International News Feed
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
The Last Watchdog
The Last Watchdog

博客园 - volnet(可以叫我大V)

OpenAI CLIP 关键点 - 连接图像和文字 【笔记】跟吴恩达和IsaFulford学提示词工程(初级开发者入门课程) MacOS使用Charles抓去HTTPS数据 在浏览器的JavaScript里new Date().toUTCString()后,传递给C# DateTime().TryParse()会发生什么? 如何安装Docker UCP Git凭证存储(简单易懂,一学就会,认真看) - volnet(可以叫我大V) - 博客园 重启Ubuntu后Hadoop的namenode起不来的解决办法‬ Git撤销提交 MVC模式下如何实现RegisterStartupScript等功能 RESTful接口设计原则/最佳实践(学习笔记) 如何编译MongoDB? 《硅谷之谜》读书笔记 Google的Bigtable学习笔记(不保证正确性) 软件开发到底是怎么一回事呢? 如何控制自己之2016个人目标管理 如何自适应网页的协议(http/https/……) 数据库时间戳设计 AngularJS-Controller的使用-读书笔记 FIM相关报错汇总
ASP.NET 上传文件最大值调整
volnet(可以叫我大V) · 2016-06-15 · via 博客园 - volnet(可以叫我大V)

首先,最容易找到的是web.config下面配置:

    <!--maxRequestLength=50MB-->
    <httpRuntime targetFramework="4.5.2" maxRequestLength="51200"/>

这么设置会将请求的尺寸从默认4MB(4096KB)提升到50MB(51200KB)。

但是,如果只是这么设置的话,你会发现你的最大上传尺寸会停止在28.6MB,更大的文件上传,将返回404.13,表示内容长度过大。

原因在于IIS的默认设置,限定了maxAllowedContentLength的值。

<element name="requestLimits"><attribute name="maxAllowedContentLength" type="uint" defaultValue="30000000" />

该值在IIS_Schema.xml中设置。(将影响整个计算机)

IISExpress:IISExpress运行路径下,C:\Program Files (x86)\IIS Express\config\schema\IIS_schema.xml
IIS7、8:C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml

如果修改了这个值没有生效,两种可能,一种是当前运行的IISExpress/IIS没有关闭/重启。一种是web.config中有额外的配置(如下文所述)。

然而为了避免总是去修改全局的值,影响到同一台服务器上的其他web站点,我们还可以在web.config中进行配置。

  <system.webServer>
    <!--
      IISExpress:C:\Users\UserName\Documents\IISExpress\config\applicationHost.config
      IIS7、8:C:\Windows\System32\inetsrv\config\applicationHost.config
      <section name="requestFiltering" overrideModeDefault="Allow" />
      overrideModeDefault值设置成Allow的时候,本配置节才会生效。
      
      也可以在IIS_Schema.xml中设置。(将影响整个计算机)
      IISExpress:IISExpress运行路径下,C:\Program Files (x86)\IIS Express\config\schema\IIS_schema.xml
      IIS7、8:C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml
      修改defaultValue="30000000"(28.6MB)为需要的值。
      <element name="requestLimits"><attribute name="maxAllowedContentLength" type="uint" defaultValue="30000000" />
    -->
    <security>
      <requestFiltering>
        <!--maxAllowedContentLength=100MB-->
        <requestLimits maxAllowedContentLength="104857600"></requestLimits>
      </requestFiltering>
    </security>

为了使该内容生效,需要配置“允许继承”,在applicationHost.config中搜索<section name="requestFiltering" overrideModeDefault="Allow" />中的关键字,确保这个值为Allow即可。

IISExpress:C:\Users\UserName\Documents\IISExpress\config\applicationHost.config
IIS7、8:C:\Windows\System32\inetsrv\config\applicationHost.config

参考资料:

http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

http://www.cnblogs.com/henryhappier/archive/2010/09/20/1832098.html

https://msdn.microsoft.com/en-us/library/ms689462(v=vs.90).aspx