- 注册时间
- 2009-12-25
- 最后登录
- 2021-7-10
- 在线时间
- 3302 小时
- 阅读权限
- 200
- 积分
- 10
- 帖子
- 13416
- 精华
- 1
- UID
- 2036
  
|
net中默只能上传小于4m的文件,大于4M将无法显示页面.那么如何设置来使imputfile能上传更大的文件呢,
% o- I6 P. K9 l' D8 Q% ]: a
4 b6 t% W8 x, J+ G5 ?
0 I" ^# k# y: ^; b; m- v, @# c b# O
1,环境:window 2003 ,IIS6.0 & r/ ?. \* N; t: i, v4 G
% b( E; {! A0 O5 t! |
要首先要修改IIS6.0中的asp请求的最大字节数,默认时为200K;
% ^1 N o1 Y# S2 l6 e% t方法:打开位于 C:\Windows\System32\Inetsrv 中的 metabase.XML, 1 z' B. d8 F# [1 w5 h. B
并修改 AspMaxRequestEntityAllowed 为你需要的值(例如 "1073741824", 1GB); , \+ Z0 I" v" i7 E
5 P" d4 A; J4 r
技术背景:
) ]4 P; a7 u! ~$ i( s; J8 c在 IIS 6.0 中, AspMaxRequestEntityAllowed 属性指定了一个 ASP 请求(Request)可以使用的最大字节数. 如果 Content-Length 头信息中包含的请求长度超过了 AspMaxRequestEntityAllowed 的值, IIS 将返回一个 403 错误信息. " [8 ?9 Z! U F" U$ P
这个属性值与 MaxRequestEntityAllowed 相似, 但是是针对 ASP 请求的. 假如你知道自己的 ASP 应用只需要处理很少的请求数据, 你可以在 World Wide Web Publishing Service (WWW 发布服务)层级设定全局的 MaxRequestEntityAllowed 属性为 1MB, 并单独设定 AspMaxRequestEntityAllowed 为一个较小的值. : ?+ p; P, }% B5 S
! U5 I! S9 S1 B
注意: 在编辑文件前请停止 IIS 服务, 否则无法保存修改后的文件.
4 m* V7 ~8 c8 J0 G+ @; @/ q
. X* o6 p$ r* S也可以那么解决: ) {/ E' v0 L4 i: L6 \( m# I
到微软站点载了IIS6 Resource Kit Tools(http://www.microsoft.com/downloa ... DE629C89499&displaylang=en),安装后利用Metabase Explorer修改了(local)\LM\W3SVC\AspMaxRequestEntityAllowed属性(默认为200K=204800),修改为1G就是了;同时修改了AspScriptTimeout属性调整下时限,就可以上传大文件了。 ; y) d' j1 [8 X, p
4 N6 b! B1 N, P, V; `5 y& d
8 H, S) a: Q# i2 c5 Z2,.net中 ! z, D2 _' x$ N, D; P) A
9 [. ^ H7 @( l. s6 `* P
(1)在web.comfig文件中添加一个httpRuntime主键 4 e# e3 Y# P: x
4 L9 U; Y( b+ J6 d0 Y2 K$ c* O/ ~
<httpRuntime executionTimeout="90" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"
+ ^' z3 g; j" O; M! t4 c4 w* A: RminFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/> ! n- \5 u4 `0 t$ i
) M& d2 W9 j: [: N5 x
maxRequestLength="40960" 是最大的请求数,单位为:K " V5 B; D6 M! i. B) u! J! T
3 W0 y4 D. B6 h5 M- o0 Q
(2)修改C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config文件 $ D+ l0 }( X) G/ e* D- [7 A& }
, V9 X7 o( K& ^/ }( [& f) ]3 S2 c
<httpRuntime executionTimeout="190" maxRequestLength="40960"
. M# }" v1 l( C; n& _! d
6 v u' s& V1 _7 q! pmaxRequestLength="40960" 是最大的请求数,单位为:K
9 R% ~6 g% _5 y. Z- g& }4 {
$ I9 |& U4 V/ t经实验,(1)和(2)只要一个就可以。 |
|