Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

c# - Upload Large files(1GB)-ASP.net

I need to upload large files of at least 1GB file size. I am using ASP.Net, C# and IIS 5.1 as my development platform.

I am using:

HIF.PostedFile.InputStream.Read(fileBytes,0,HIF.PostedFile.ContentLength)

before using:

File.WriteAllBytes(filePath, fileByteArray)

(doesnt go here but gives System.OutOfMemoryException exception)

Currently I have set the httpRuntime to:

executionTimeout="999999" maxRequestLength="2097151"(thats 2GB!) useFullyQualifiedRedirectUrl="true" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000" enableVersionHeader="true" requestLengthDiskThreshold="8192"

Also i have set maxAllowedContentLength="**2097151**" (guess its only for IIS7)

I have changed IIS connection timeout to 999,999 secs too.

I am unable to upload files of even 4578KB (Ajaz-Uploader.zip)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

We have an app that occasionally needs to upload 1 and 2 GB files, so has been running into this as well. After much research, my conclusion is that we need to implement the previously mentioned NeatUpload, or something like it.

Also, be aware that

<requestLimits maxAllowedContentLength=.../>

is measured in bytes, while

<httpRuntime maxRequestLength=.../>

is measured in kilobytes. So your values should look more like this:

<httpRuntime maxRequestLength="2097151"/>
...
<requestLimits maxAllowedContentLength="2097151000"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...