使用环境:Window Server2008 + IIS7
更改web.config配置
1.在<configSections></configSections>节内加入:
<section name="neatUpload" allowLocation="true" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload"/>
2.在<configSections></configSections>后添加<neatUpload>节点:
<neatUpload useHttpModule="true" maxNormalRequestLength="2048000" maxRequestLength="2048000" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>
3.在<system.web></system.web>节内添加:
<httpRuntime maxRequestLength="2048000" executionTimeout="3600" useFullyQualifiedRedirectUrl="true" />
其中executiontimeout是用来控制http请求时间的,如过不设置默认是90秒,大文件上传过程会被终止
4.加入<system.webServer></system.webServer>节内添加:
<system.webServer>
<modules>
<!--上传大文档-->
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" preCondition="managedHandler"/>
</modules>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="3947483648" ></requestLimits>
</requestFiltering>
</security>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
其中,如果不配置<security></security>大文件上传 “进度条”出现但不会有进度,因为maxallooedcontentlenght因为考虑到安全因素被限制