473,379 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Response.WriteFile very slow on large files

I'm trying to write files directly to the client so that it forces the client to open the Save As dialog box rather than
display the file. On some occasions the files are very large (100MB+). On these files teh time that it takes until the
client displays the Save As dialog can be extrordinarily long (3+ minutes). I don't understand why.

I was initiall using the format:

Respnse.writefile("filepath", offset, length)

but that simply failed with the user getting a "document contains no data" message. Then I switched to using the
following version of the method:

Respnse.writefile(filepointer, offset, length)
That works but again it takes a long time for the user to get the Save As dialog. I have always used the
Response.BufferOutput = False command to theoretically prevent buffering. My server, not initially intending to
be server these large files only has 256MB of RAM. Not much but considering that the files are not supposed to be
getting buffered it should be enough to download files to clients (which is all this server does).

The CPU usage is not an issue as it only goes to about 10% (although not solidly 10%) during the 3 minutes or so it
takes to start writing the file to the client. The disk usage however is a different story, both reads and writes go
through the roof. (writes presumably because it's paging the data since I have so little physical RAM).

So, does response.writefile ignore the BufferOutput property?

Any suggestions about how to improve performance?

--Buddy
Nov 19 '05 #1
3 6279
This a known limitation of ASP.NET, which comes from the way data is sent
from the worker process to the IIS process (by named pipes). Use
Response.TransmitFile insted of WriteFile (this method is a new method
introduced in .NET 1.1 SP1 I think).

Regards

François

"Buddy Ackerman" wrote:
I'm trying to write files directly to the client so that it forces the client to open the Save As dialog box rather than
display the file. On some occasions the files are very large (100MB+). On these files teh time that it takes until the
client displays the Save As dialog can be extrordinarily long (3+ minutes). I don't understand why.

I was initiall using the format:

Respnse.writefile("filepath", offset, length)

but that simply failed with the user getting a "document contains no data" message. Then I switched to using the
following version of the method:

Respnse.writefile(filepointer, offset, length)
That works but again it takes a long time for the user to get the Save As dialog. I have always used the
Response.BufferOutput = False command to theoretically prevent buffering. My server, not initially intending to
be server these large files only has 256MB of RAM. Not much but considering that the files are not supposed to be
getting buffered it should be enough to download files to clients (which is all this server does).

The CPU usage is not an issue as it only goes to about 10% (although not solidly 10%) during the 3 minutes or so it
takes to start writing the file to the client. The disk usage however is a different story, both reads and writes go
through the roof. (writes presumably because it's paging the data since I have so little physical RAM).

So, does response.writefile ignore the BufferOutput property?

Any suggestions about how to improve performance?

--Buddy

Nov 19 '05 #2
That's a great fix for large files, but there is a known issue with it
running on Windows Server 2003 SP1. It doesn't work. :-(

I've been trying to get a fix or a work around for it, but Microsoft only
has an unsupported fix for it.

--
Pat B
BCC Software, Inc
A BÖWE BELL + HOWELL COMPANY
"François Lemaire" wrote:
This a known limitation of ASP.NET, which comes from the way data is sent
from the worker process to the IIS process (by named pipes). Use
Response.TransmitFile insted of WriteFile (this method is a new method
introduced in .NET 1.1 SP1 I think).

Regards

François

"Buddy Ackerman" wrote:
I'm trying to write files directly to the client so that it forces the client to open the Save As dialog box rather than
display the file. On some occasions the files are very large (100MB+). On these files teh time that it takes until the
client displays the Save As dialog can be extrordinarily long (3+ minutes). I don't understand why.

I was initiall using the format:

Respnse.writefile("filepath", offset, length)

but that simply failed with the user getting a "document contains no data" message. Then I switched to using the
following version of the method:

Respnse.writefile(filepointer, offset, length)
That works but again it takes a long time for the user to get the Save As dialog. I have always used the
Response.BufferOutput = False command to theoretically prevent buffering. My server, not initially intending to
be server these large files only has 256MB of RAM. Not much but considering that the files are not supposed to be
getting buffered it should be enough to download files to clients (which is all this server does).

The CPU usage is not an issue as it only goes to about 10% (although not solidly 10%) during the 3 minutes or so it
takes to start writing the file to the client. The disk usage however is a different story, both reads and writes go
through the roof. (writes presumably because it's paging the data since I have so little physical RAM).

So, does response.writefile ignore the BufferOutput property?

Any suggestions about how to improve performance?

--Buddy

Nov 19 '05 #3
the "save as" dialog box will not appear until the client has fully
downloaded the file. while switching to TransmitFile lowers server resources
used, it will not reduce the transmit time of a 100mb file by much. the http
protocol is fairly slow for large file downloads (especially on a win2k
client and its piggyback acks).

-- bruce (sqlwork.com)
"PatB" <Pa**@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
That's a great fix for large files, but there is a known issue with it
running on Windows Server 2003 SP1. It doesn't work. :-(

I've been trying to get a fix or a work around for it, but Microsoft only
has an unsupported fix for it.

--
Pat B
BCC Software, Inc
A BÖWE BELL + HOWELL COMPANY
"François Lemaire" wrote:
This a known limitation of ASP.NET, which comes from the way data is sent
from the worker process to the IIS process (by named pipes). Use
Response.TransmitFile insted of WriteFile (this method is a new method
introduced in .NET 1.1 SP1 I think).

Regards

François

"Buddy Ackerman" wrote:
> I'm trying to write files directly to the client so that it forces the
> client to open the Save As dialog box rather than
> display the file. On some occasions the files are very large (100MB+).
> On these files teh time that it takes until the
> client displays the Save As dialog can be extrordinarily long (3+
> minutes). I don't understand why.
>
> I was initiall using the format:
>
> Respnse.writefile("filepath", offset, length)
>
> but that simply failed with the user getting a "document contains no
> data" message. Then I switched to using the
> following version of the method:
>
> Respnse.writefile(filepointer, offset, length)
>
>
> That works but again it takes a long time for the user to get the Save
> As dialog. I have always used the
> Response.BufferOutput = False command to theoretically prevent
> buffering. My server, not initially intending to
> be server these large files only has 256MB of RAM. Not much but
> considering that the files are not supposed to be
> getting buffered it should be enough to download files to clients
> (which is all this server does).
>
> The CPU usage is not an issue as it only goes to about 10% (although
> not solidly 10%) during the 3 minutes or so it
> takes to start writing the file to the client. The disk usage however
> is a different story, both reads and writes go
> through the roof. (writes presumably because it's paging the data
> since I have so little physical RAM).
>
> So, does response.writefile ignore the BufferOutput property?
>
> Any suggestions about how to improve performance?
>
>
>
> --Buddy
>

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jerry J | last post by:
I am using Response.WriteFile to send file streams back to web clients. My question is this: Can I use Response.WriteFile(SomeFilePath) for any size file? Will it handle chunking the data...
4
by: whoopdaddy | last post by:
We are streaming a PDF file out of an ASPX page in IIS 5 using Response.WriteFile so the user does not need permissions to the directory where the files are stored. This works great when the user is...
4
by: JIM.H. | last post by:
Hello, I use this: Response.Redirect("/Files/myFile.xls") which is working fine but shows address bar and I am trying to get rid of it. So if I have the following, will this let me see excel...
8
by: Scott C. Reynolds | last post by:
I want to serve a PDF right to a web page (cannot link browser directly to PDF file). Stumbled across Response.WriteFile this morning. On my machine (XP Pro) this worked fine: private void...
2
by: Buddy Ackerman | last post by:
I am creating a ZIP file on the fly and streaming it out to the client using Response.WriteFile(FileName, StartPos, FileSize). Because this ZIP contains files that are on my server and I don't...
1
by: Ryan Pedersen | last post by:
I have been trying to figure out how to transmit a file back to a user using the response.transmitfile or response.writefile method and just not having much success. I have a dell server running...
2
by: dotnettester | last post by:
Hi, I am using Response.writefile to write a file into clients browser. It works fine with files upto 60MB. When I come across a file size bigger than that, it break with error saying page can...
5
by: Khafancoder | last post by:
Hi guys, i am building a FileSharing website, i wanna allow users to be able using download managers such as DAP to download files from webserver but don't allow them to retrive files url......
2
by: Nathan Sokalski | last post by:
I have an application in which I want to allow users to view certain files that are on the server, but not part of the application. To do this, I figured I would have ASP.NET read the files and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.