同时上传大型视频'system.outofmemoryexception'抛出

时间:2012-08-01 09:11:10

标签: asp.net

我正在尝试使用上传处理程序上传视频,但在上传大型视频文件system.outofmemoryexception时会抛出。我的代码在下面

using System.Collections.Generic;
using System;
using System.Drawing;
using System.Web;
using System.IO;
using SageFrame.Web;
using System.Web.SessionState;
using System.Web.Configuration;

public class UploadHandler : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        HttpRuntimeSection configSection = new HttpRuntimeSection();
        context.Response.Write(configSection.MaxRequestLength);  
        HttpRequest Request = HttpContext.Current.Request;
        HttpFileCollection myfile = Request.Files;  ////Here i get error     
    }
}

我正在使用VS2010谢谢。

1 个答案:

答案 0 :(得分:0)

根据建议,您可能需要更改HttpRuntime maxRequestLength属性以允许大文件大小。指定的大小以千字节为单位,下面的示例将其设置为100MB:

<httpRuntime maxRequestLength="102400"/>