eWorld.UI - Matt Hawley

Ramblings of Matt

Large File Uploading in ASP.NET

May 11, 2004 18:40 by matthaw

I posted this to the ASP.NET forums back in November of 2002, and, too much of my dismay, still is an issue and people are still having problems figuring this out. I don't really know how many times I've helped people with this problem, and just recently I had to do the same. So, for my own personal reference (mainly), and to share the information, I decided to re-post it in my blog...

First the good...

To upload large files, and not receive the DNS Error or the page stopping while uploading, we found several settings between the machine.config and the web.config files that you need to modify. There are specifically 3 places, 2 of which can be overwritten in your web.config file.

In your web.config, add a line under your system.web <httpRuntime executionTimeout="54000" maxRequestLength="512000" /> where execution timeout is in seconds, and maxRequestLength is in KB. executionTimeout, is basically the amount of time a thread will continue to run, and accept data by IIS/.NET. maxRequestLength, is the total amount of data that can be sent through HTTP Post to the server. The default is 4MB (4096)...and is generally set low so that your server will not be overwhelmed by possible DoS attacks.

In your machine.config, modify responseDeadlockInterval to equal the same amount of time for executionTimeout. responseDeadlockInterval, is basically the amount of time that the Client's browser and Server will continue to communicate. Every several minutes or so, the server polls the client, asking if they have any more information to send, if they do not receive anything back after several times, then the server stops the current thread and all communication is stopped. This is the cause of the DNS Error you may see sometimes.

These 3 changes will allow you to successfully upload large files.

Now...the bad...

Memory deallocation is a major issue, that has no current solution. Whenever you upload files via HTTP Post, the file is stored in the memory of the aspnet_wp.exe process, and never deallocates completely (if your lucky a few MB gets released). One of the config settings for .NET processes, allows them to utilize 60% of physical memory on the server, at which point the process is recycled and all execution is stopped. Whenever a new upload is started, though, some memory is de-allocated, but not enough compared to memory that was used in prior uploads.

Microsoft is aware of this problem, and has assured us that it will be fixed with some upcoming releases of the .NET framework. Some solutions that they suggested to us, was to use Classic ASP, Third Party Components, or Custom Built ISAPI filters. Because of our solution we were using this in, we could do none of the three, so we topped the server out at 2GB of RAM. This has provided us with some breathing room if several people start uploading huge files, and gives us enough time to restart IIS if we start nearing 1.3GB of RAM being used by aspnet_wp.exe.



Categories: .NET
Actions: E-mail | Permalink | Comments (5) | Comment RSSRSS comment feed

EmptyDataGrid - Bug

May 11, 2004 00:42 by matthaw

I was working with my EmptyDataGrid control on a project at work today, when I noticed a bug that could affect just about anyone using it. It turns out that if you have Paging turned on, and no data is returned, the EmptyTemplate gets appended to the DataGrid after the Pager item.

Therefore, a workaround is in need, so before you bind to the EmptyDataGrid, run this check:

[VB.NET]
If DataSet1.Tables(0).Rows.Count = 0 Then
  EmptyDataGrid1.AllowPaging = False
Else
  EmptyDataGrid1.AllowPaging = True
End If

[C#]
if(DataSet1.Tables[0].Rows.Count == 0)
{
    EmptyDataGrid1.AllowPaging = false;
}
else
{
    EmptyDataGrid1.AllowPaging = true;
}

I've noted this bug to be fixed in the next version.



New BlogJet - Not Free Anymore

May 8, 2004 18:39 by matthaw

Well as I BlogJet kept telling me that it was time to upgrade, I kept checking. Alas, today there is a new version. However, its not Beta anymore, and comes with a 30-day trial and a $19.95 registration fee. I guess I actually have to determine how much I like BlogJet over other free utilities now.

Ohh - there is also a new website design too. Very sweet.

BlogJet 1.0.0.18 Final Release

FEATURES
* Autodetection of proxy settings.

BUG FIXES
* Fixed extra ="" in hyperlinks.
* "Insert hyperlink" menu did nothing.
* mailto: hyperlinks now work correctly.
* A lot of other bug fixes.



Categories: General
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Longhorn Notepad Icon

May 7, 2004 22:01 by matthaw

NotepadNot sure if anyone noticed, but the latest build of Longhorn, 4074, has a completely different icon for Notepad now.

It also looks as if a bunch of other icons got a rework, I'm starting to think it looks more and more like Gnome/Mac OS X now.



Categories: General
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Are we Greedy for Speed?

May 7, 2004 19:33 by matthaw

I'm sitting here watching over my download from MSDN for the Longhorn 7.2 SDK, and I constantly find myself suspending and resuming the download. But, why? Well, because I think downloading the 700MB file at 40 KB/sec is just too darn slow, so if I suspend and resume, it'll jump to above 100KB to 200KB for about 1 more minute.

This just kind of got me started thinking, why are we so greedy for speed? I remember the days of the old 14.4K modems and (of course) the old baud modems that were slower than crap. I remember rejoicing whenever I was downloading at about 1.5KB, and thought it was so extremely cool.

Now adays, that 1.5KB seems to just be insane, and unable to do anything on the internet. When did this shift change? Was it the when the wide popularity grew for broadband access? No, I believe it to be whenever ISDN was starting to become available to residential areas. However, ISDN still is slow and sluggish in most of our eyes.

So, why am I thinking that 40KB a second is so darn slow? I don't know, I guess I'm just speed greedy like everyone else in the world with broadband access. Are you greedy?



Categories: General
Actions: E-mail | Permalink | Comments (3) | Comment RSSRSS comment feed

Looping for Dummies

May 7, 2004 16:53 by matthaw

Ahh, so I just had a revisit of why For loops are not as good as While loops sometimes. Most commonly, I try to avoid using While loops, but after trying to convert this Master Detail example I realized that I needed a While loop instead of a For loop.

Why? Well, if you look at that example, it shows that it is using a post processing incrementor, and well, VB.NET doesn't have this. So, I had to come up with the same basic functionality, but it posed definate problems because it wasn't going through all of the rows in the DataGrid.

My first attempt created a variable for the upper bound item which I had to go to, however this variable had to be modified when a new row was added (so it would get to all of the rows). Well, after playing with it for awhile, I realized that when using a For loop, you cannot increment that upper bound variable and have it applied on the fly. The For loop takes whatever it is and stores the value and not the reference to the variable.

Ahh - so this is where the While loop comes in. After changing the loop to it, I was able to increment my upper bound variable and gain access to all of the rows in the datagrid.

So remember:

Dim i As Integer
Dim j As Integer = 10

For i = 0 To j
  If somethingIsTrue Then
    i += 1
    j += 1
  End If
Next

will not work, but:

Dim i As Integer = 0
Dim j As Integer = 10

While i <= j
  If somethingIsTrue Then
    i += 1
    j += 1
  End If
  i += 1
End While

Will work!



Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Yes I am...

May 6, 2004 01:29 by matthaw

... downloading longhorn, but I don't have time to do some of the suggested things because its almost time for our Central IL Dot Net User Group meeting.

So like, maybe tomorrow night I'll be able to install the WinHec version, but who knows - I may be playing with my new TiVo. Ohh, what an exciting week.



Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Central IL Dot Net User Group Meeting Tonight

May 5, 2004 18:08 by matthaw

If you're in the Central IL area tonight and would like to take a glimpse into my company and our efforts into the K-12 market using SIF, make sure you stop by the Central IL Dot Net User Group meeting.

Brian Bussing and Jason Wrage from Integrity Technology Solutions will be presenting on our development architecture and the School Interoperability Framework (better known as SIF). During the SIF portion, a demo will be shown on an example Zone Integration Server with a few agents interacting together. Not only will they hype SIF, but satisfy your taste buds with a great demo.

We will be meeting at 6:00 PM at the Microsoft Office in Bloomington, IL. Free pizza and soda are available to all who wish to come. Contact me if you need help or directions. Hope to see you there!



Free NFR VB.NET 2003 Standard

May 5, 2004 16:32 by matthaw
Just saw this come across SlickDeals.net, but in short - you can get a free copy (not for resale) of Visual Basic .NET 2003 Standard by just viewing and rating 5 movies from VB @ the Movies. This would be very cool, if I didn't already have VS.NET 2003, but I may just check out the movies & get a free copy anyway.

Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Got GMail?

May 4, 2004 16:58 by matthaw

GMAIL REQUESTERS: This is NOT a place for requesting GMail accounts. I IGNORE each one of these pleas for an account, and have ALREADY given away my 3 invites.

I love when I write a post that starts with or has a title that makes me think of a movie, commercial, ad, or something just completely wacky. I guess this one relates to the "Got Milk?" ad...ohh good times.

Anyway, to the point of this post, I wanted to just mention that I got an invite for GMail the other day. Which is really kind of sweet because I stuck my email address on the wiki at Channel9 like 2 or 3 days prior thanks to John Sands

What little I've used it, I'm impressed. It's a very simple interface, and the threading of conversations / searching through email is just frigging sweet. So yeah, rock on GMail!

Update: Found his blog, thanks John!



Categories: General
Actions: E-mail | Permalink | Comments (106) | Comment RSSRSS comment feed


Copyright © 2000 - 2025 , Excentrics World