这是IIS限制了,解决办法如下:
windows2003的IIS有限制文件上传大小问题超过200K的文件就传不上去了,大家可要注意了,以后要是用IIS6.0做服务器可就要注意了,Win2003的IIS 6.0对asp的上传文件大小为200k限制,aspx的上传程序没有影响。在IIS6.0中,默认设置是特别严格和安全的,最大只能传送 204,800 个字节,这样可以最大限度地减少因以前太宽松的超时和限制而造成的攻击。IIS 6 出于安全考虑, 默认最大请求是200K(也即最大提交数据限额为200KByte,204800Byte)。(在 IIS 6.0 之前的版本中无此限制)。
解决办法:
1. 关闭 IIS Admin Service 服务
2. 打开 %WinDir%\system32\inetsrv\metabase.xml
3. 修改 AspMaxRequestEntityAllowed 的值为自己需要的, 默认为 204800
4. 启动 IIS Admin Service
windows2003的IIS有限制文件上传大小问题超过200K的文件就传不上去了,大家可要注意了,以后要是用IIS6.0做服务器可就要注意了,Win2003的IIS 6.0对asp的上传文件大小为200k限制,aspx的上传程序没有影响。在IIS6.0中,默认设置是特别严格和安全的,最大只能传送 204,800 个字节,这样可以最大限度地减少因以前太宽松的超时和限制而造成的攻击。IIS 6 出于安全考虑, 默认最大请求是200K(也即最大提交数据限额为200KByte,204800Byte)。(在 IIS 6.0 之前的版本中无此限制)。
解决办法:
1. 关闭 IIS Admin Service 服务
2. 打开 %WinDir%\system32\inetsrv\metabase.xml
3. 修改 AspMaxRequestEntityAllowed 的值为自己需要的, 默认为 204800
4. 启动 IIS Admin Service
解决方案 »
- 很奇怪的问题...
- 怎么设置DetailsView更新操作
- asp.net 后台调用前台的js里面的方法
- 请教:关于URL的两个问题,HELP^^^^^^
- 请教高手:什么样的情况会导致这种异常
- asp.net如何获取浏览器信息,还有怎么打印页面中的一个表格?
- 用ASP.NET代码删除某一文件夹里的一张图片
- 邮件发送问题,很怪..郁闷..
- 可不可以使iframe随引用页面变大而变大,由于美观原因不能用滚动条
- 能否直接更改DATAGRID中的值,并提交数据库?
- 只有在配置文件或 Page 指令中将 enableSessionState 设置为 true 时,才能使用会话状态。还请确保在应用程序配置的 <configuration>\<sy
- 打包警告: 两个或多个对象具有相同的目标位置(“[targetdir]\bin\test.dll”)是怎么回事?
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CSharpUpload.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
<INPUT type=file id=File1 name=File1 runat="server" >
<br>
<input type="submit" id="Submit1" value="Upload" runat="server" NAME="Submit1">
</form>
</body>
</HTML>
WebForm1.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace CSharpUpload
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
if( ( File1.PostedFile != null ) && ( File1.PostedFile.ContentLength > 0 ) )
{
string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
string SaveLocation = Server.MapPath("Data") + "\\" + fn;
try
{
File1.PostedFile.SaveAs(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
}
}
else
{
Response.Write("Please select a file to upload.");
}
}
}
}
<httpRuntime maxRequestLength="上传文件最大字节数"/>
用ASP.NET上传大文件
http://blog.joycode.com/saucer/archive/2004/03/16/16225.aspx
<httpRuntime maxRequestLength="10240" executionTimeout="3600"/>
enctype ="multipart/form-data"
当使用这种格式后,就是将<INPUT type="file">选中的文件内容以二进制形式上传到服务器.如果不使用,就只将选中的文件名的字符串上传的服务器<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
<INPUT id="File1" type="file" name="File1" runat="server">
<asp:Button id="Button1" runat="server"Text="上传"></asp:Button>
</form>
-----------------------服务器
//文件在用户端的盘符路径文件名
string Cfilename=File1.PostedFile.FileName;string filename=System.IO.Path.GetFileName(Cfilename);
string serverPath =string.Format(@"c:\temp\{0}",filename);
//保存文件
File1.PostedFile.SaveAs(serverPath);this.Response.Write("文件名:" + filename + "<p>");
this.Response.Write("文件大小" + filesize + "<p>");this.Response.Write("上传成功");web config
<httpRuntime executionTimeout="300" maxRequestLength="1000000" useFullyQualifiedRedirectUrl="false"/>
<httpRuntime maxRequestLength="10240" executionTimeout="3600"/>
--------------------
up
文件MD5值计算进度:文件MD5值计算完毕文件上传中文件上传完毕