Last post Jan 28, 2015 09:04 AM by Mikesdotnetting
Jan 28, 2015 06:26 AM|Surendiran|LINK
In our asp.net application when the user clicks on the button download we need to fetch data from the database and needs to write all the records in an excel file.
Similarly when the user click on upload the application needs to read all the records and its should bind in to a grid.
The table will have around 25 columns and minimum record count will be around 2000 or it may increase to 10,000 or 20,000
Is it Is it good practice to read or write huge volume of an excel file in asp.net. Please suggest.
We are using open excel for excel read and write
Jan 28, 2015 08:00 AM|Mikesdotnetting|LINK
I don't think this is a question of good practice. If your business requirements include exporting loads of data to Excel then that's what you have to do. However, I cannot think of any sane reason to display thousands of rows of data on a web page. If you
want to display data on a web page, it's usually a good idea to provide the user with mechanisms to filter it if appropriate, but definitely to paginate it.
Jan 28, 2015 08:45 AM|Surendiran|LINK
I have suggested to create a windows service to read records from the excel and insert into the table.
And for excel download the same windows service will read the records and write an excel file and once the file got created we will send notification as email attachment to the user.
The reason why i proposed this windows service is reading an excel file and writing an excel file in Asp.net when there is huge volume of record leads to peformance issue when there more number of users.
Please suggest your thoughts which one is better idea and which one is reliable
Jan 28, 2015 08:58 AM|AidyF|LINK
If you are expecting heavy load and\or the files being generated are large or involve a lot of data then using a service to do the work is a good idea as it takes a lot of resource strain away from IIS, and the service can plod through the file generation
at its own pace. You can look into something like MSMQ which can be used to queue up your file generation requests, and your service can simply subscribe to the queue and process the requests as they come in.
For follow up questions you might be better with the general MSDN forums as services, MSMQ etc are all outside the scope of this forum.
Jan 28, 2015 09:04 AM|Mikesdotnetting|LINK
If your current approach is causing performance issues, then you should pass the tasks off to a different process. One way to do this is to put it in a separate application like a service. Another is to use Async Tasks (https://msdn.microsoft.com/en-us/magazine/ff959203.aspx).
The code you write to read and write the data is going to be identical, regardless whether it is in a web app or windows service. So reliability will be the same.