即使在web.config中添加了节点和设置依然是不行的,还是报文件太大的错误,
<httpModules> <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload"/> </httpModules> <httpRuntime executionTimeout="6000000000" maxRequestLength="900000000" useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" maxQueryStringLength="10240" />
解决方法需要做到以下三个才能解决问题:
1:在web.config文件中,的configuration节点下的第一个节点添加如下节点:
- <configuration>
-
- <configSections>
- <sectionGroup name="system.web">
- <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
- </sectionGroup>
- </configSections>
<configuration>
<!--解决上传文件太大的错误 -->
<configSections>
<sectionGroup name="system.web">
<section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
</sectionGroup>
</configSections>
2:在web.config文件下的system.web的节点下添加如下节点
- <system.web>
- <neatUpload useHttpModule="false" maxNormalRequestLength="40960000" maxRequestLength="20971510000" defaultProvider="FilesystemUploadStorageProvider">
- <providers>
- <add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
- </providers>
- </neatUpload>
<system.web>
<neatUpload useHttpModule="false" maxNormalRequestLength="40960000" maxRequestLength="20971510000" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>
3:这个时候你会发现本地是可以上传成功了,但是在IIS上依旧不行,你需要在IIS中去设置IIS的上传大小,设置方法如下:
修改IIS的applicationhost.config 文件位置: %windir%/system32/inetsrv/config/applicationhost.config
找到<requestFiltering>节点,注意requestFiltering节点默认下面是没有requestLimits 节点的,你需要添加如下节点,当然,如果节点已经存在,则只需修改
为这个节点添加如下元素:
<requestLimits maxAllowedContentLength="2147483647" /> (上传的大小将改为2G)
这个时候你会发现已经OK了。
注意:在除了修改IIS文件的办法,修改配置文件也可以,亲身体验过:
- <system.webServer>
- <security>
- <requestFiltering>
- <requestLimits maxQueryString="10240" maxAllowedContentLength="2147483647" />
- </requestFiltering>
- </security>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="10240" maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
|
请发表评论