Hello, I am working in c# asp.net.
I have bulk upload functionality with 45000 records in excel.
When i upload it through my code it uploads approximate 5000-6000 records.
why it does not upload all 45000 records in db ?
Also, any asp.net c# code will be very useul, that upload all records from excel ...
Thanks in advance !
Sandhiya PriyaPosted Oct 25, 2025, 6:25 AM
There can be several possible reasons:
1. Timeout or request length exceeded
ASP.NET web apps have limits to avoid long-running requests:
Default request timeout = 110 seconds.
MaxRequestLength (in web.config) limits upload file size (default is 4MB).
If your Excel or operation takes too long, the request stops mid-way.
Fix: Increase timeouts in web.config
(Above allows 50MB file and 10-minute timeout.)
2. Connection or SQL Timeout
SQL commands may time out when inserting huge data.
Fix:
3. Reading Excel inefficiently (row-by-row)
If you’re using
OleDbConnectionor looping per row withINSERT, it’s very slow and sometimes stops after a while due to memory leaks.Better Solution: Read Excel ? DataTable ? Bulk Copy to SQL
Efficient ASP.NET C# Code Example
Here’s a robust method using
EPPlus+SqlBulkCopy(best for large uploads):Install NuGet packages:
Code:
Tips for Large Uploads (45,000+ rows)
Prasad RaveendranPosted Sep 20, 2025, 4:40 AM
give a try with the below packages
Install-Package ExcelDataReader
Install-Package ExcelDataReader.DataSet
Sepehr ShnPosted Sep 19, 2025, 5:20 PM
You can convert Excel to JSON using an existing library, and then use
Parallel.ForEachto enhance performanceSangeetha SPosted Sep 19, 2025, 4:56 AM
bulk upload is only inserting around 5,000–6,000 records out of 45,000, there could be several reasons behind this memory issue and time out , Excel read limitation possible of reason. recommended to use EPPlus library