當上傳一個超過30M的文件時,服務器會重定向至404.13頁面,報錯以下:web
此請求的查詢字符串的長度超過配置的 maxQueryStringLength 值windows
1、全局配置 C:\Windows\System32\inetsrv\config目錄下的applicationhost.config (iis配置文件)api
1. 配置節system.webServer/security/requestFiltering/ 下增長如下配置服務器
maxAllowedContentLength的單位爲Bytesapp
<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="40000000" /> </requestFiltering> <security> <system.webServer>
2、局部配置 ide
1. applicationhost.config容許配置覆蓋, "Deny" to "Allow" like so: (IIS7.5 默認Allow)
spa
<sectionGroup name="security"> <section name="access" overrideModeDefault="Deny" /> <section name="applicationDependencies" overrideModeDefault="Deny" /> <sectionGroup name="authentication"> <section name="anonymousAuthentication" overrideModeDefault="Deny" /> <section name="basicAuthentication" overrideModeDefault="Deny" /> <section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <section name="digestAuthentication" overrideModeDefault="Deny" /> <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <section name="windowsAuthentication" overrideModeDefault="Deny" /> </sectionGroup> <section name="authorization" overrideModeDefault="Allow" /> <section name="ipSecurity" overrideModeDefault="Deny" /> <section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> <section name="requestFiltering" overrideModeDefault="Allow" /> </sectionGroup>
2. Web。config文件 system.webServer/security/節下增長如下配置.net
<requestFiltering> <requestLimits maxUrl="409600" maxQueryString="204800" maxAllowedContentLength="2097152" /> <!--單位字節Byte(2048000)--> <fileExtensions> </fileExtensions> </requestFiltering>
Web,configcode
<configuration> <system.web>
</system.web> </configuration>
【參考文獻】https://blog.csdn.net/yw1688/article/details/49070633blog