I am getting below exception in my application at line:
Workbook workbook = new Workbook(fstream);
Exception:
Exception of type 'System.OutOfMemoryException' was thrown.
C# Code:
string tempPath = @"C:\File\01_TDv01.xlsx";
foreach (string templateFile in Directory.GetFiles(tempPath))
{
using (FileStream fstream = new FileStream(templateFile, FileMode.Open))
{
Workbook workbook = new Workbook(fstream); //getting exception here
Worksheet worksheet = workbook.Worksheets[0];
ArrayList List = new ArrayList();
//other code
}
}
catch (Exception ex)
{
}
I am processing the Excel file of size 38,436 KB; with 10K rows in it.
Web Config Settings:
<add key="maxFileSizeLimit" value="2147483647" />
<httpRuntime targetFramework="4.5" maxQueryStringLength="52768" enable="true" maxRequestLength="2147483647"/>
<requestLimits maxQueryString="52768" maxAllowedContentLength="4294967295" />
What is wrong in my code and how can I resolve this exception?
I can't make lot of changes in code as it is already live.