-2

アップロード ハンドラを使用してビデオをアップロードしようとしていますが、アップロード中に大きなビデオ ファイルが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おかげさまで使っています。

4

1 に答える 1

0

示唆されているように、おそらく HttpRuntime の maxRequestLength 属性を変更して、大きなファイル サイズに対応できるようにする必要があります。指定されたサイズはキロバイト単位で、以下の例では 100MB に設定されています。

<httpRuntime maxRequestLength="102400"/>
于 2012-08-01T10:46:59.307 に答える