[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 800
  • Last Modified:

Getting "Out of memory." error while trying to upload file to .NET application

When I try uploading large files to my .NET website, I receive an "Out of memory" error (see code below).

I am using .NET 3.5 and Windows Server 2003 (4GB RAM).

"Memory Recycling" options are disabled in the Application Pool.

Does anybody know how to resolve or workaround this?
Out of memory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.OutOfMemoryException: Out of memory.
 
Source Error:
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
Stack Trace:
 
[OutOfMemoryException: Out of memory.]
   System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) +398848
   System.Drawing.Image.FromFile(String filename) +6
   Administrator_VideoCRUD.SaveVideo() +1256
   Administrator_VideoCRUD.btnSave_Click(Object sender, EventArgs e) +5
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Open in new window

0
bearclaws75
Asked:
bearclaws75
1 Solution
 
GiftsonDJohnCommented:
Hi

Please check the KB article

http://support.microsoft.com/kb/810109


Also the problem could happen if the security settings prohibit access to the file. This exception will occur if the file is corrupt or not able to read the file.
0
 
AsishRajCommented:
investigate why you are getting out of memory

http://www.eggheadcafe.com/articles/20060114.asp
0
 
ReejishCommented:
At the time of the issue are you getting Event ID: 2020 in the system event log?. It could be possible that we might be running out of page pool memory. You could impliment the below mentiond registry change and see if that makes any difference. Also check the memory utilization at the time of the issue

Registry setting 1
=================
1) Click Start, click Run, type regedit in the Open box, and then click OK.
2) Locate and then click the following registry subkey:
3) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
4) On the Edit menu, point to New, and then click DWORD Value.
5) Type PoolUsageMaximum as the entry name, and then press ENTER.
6) Right-click PoolUsageMaximum, and then click Modify.
7) Click Decimal.
8) In the Value data box, type 40, and then click OK.

Registry setting 2
==============
1) Click Start, click Run, type regedit in the Open box, and then click OK
2) Locate and then click the following registry subkey:
3) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
4) On the Edit menu, point to New, and then click DWORD Value.
5) Type PagedPoolSize as the entry name, and then press ENTER.
6) Right-click PagedPoolSize, and then click Modify.
7) Click Hexadecimal.
8) In the Value data box, type a value of FFFFFFFF, and then click OK.

0
 
bearclaws75Author Commented:
I think the problem is that we are using SQL Server *Express* which has a memory limit of 1GB.

I am now investigating from that angle to see if it helps. Thanks for your suggestions so far.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now