2

@Scripts.Render() throws this error;

An exception of type 'System.OutOfMemoryException' occurred in WebGrease.dll but was not handled in user code

in my layout page when I am trying to include a 10 MB js file. Other scripts are working fine.

mw509
  • 1,957
  • 1
  • 19
  • 25
  • 1
    Holy moly that's a big JS file, why on earth do you need that?! – DavidG Mar 09 '20 at 12:36
  • and what is the size of the other js files? – mw509 Mar 09 '20 at 12:39
  • Other files are of below 1 MB. I am try to add this js because my client does not like that big DevExpress DXR extension in source code. So I thought I clould just save it as a file and render it through bundles. – Gourab dhargupta Mar 09 '20 at 12:57

1 Answers1

0

First of all this is not really advisable. uploading such huge files is not exactly a great solution. Do consider other methods.

In anyway, here are a few things you could try to solve your problem;

Solution 1. If you are running on 64 bit Windows and you have enough free memory, ensure that the platform target is set correctly in the project properties > build properties.

Solution 2. If you are using .NET 4.5 or greater you can add this line to the runtime section of your App.Config:

<runtime> 
   <gcallowverylargeobjects enabled="true"></gcallowverylargeobjects> 
</runtime>

Solution 3. You could increase the maxRequestLengthin your web config file.

<httpRuntime executionTimeout="3600" maxRequestLength="102400"/>

Let me know if any of this works.

Reference:

[1] https://support.microsoft.com/en-us/help/2020006/how-to-troubleshoot-out-of-memory-issues-system-outofmemoryexception-i [2] https://forums.asp.net/t/1548237.aspx?ASP+NET+2+0+System+out+of+memory+exception [3] How to upload up 10gb file on ASP.NET [4] https://systemoutofmemory.com/blogs/the-programmer-blog/c-out-of-memory-exception

mw509
  • 1,957
  • 1
  • 19
  • 25
  • Thanks for the help, but it did not work. Although I am still able to render it through – Gourab dhargupta Mar 10 '20 at 11:45