简体   繁体   中英

Large import job to WCF service causing timeout

I've got a large excel spreadsheet that I need to convert and import into a sql server database. I'm using a Silverlight front end which basically sends the file to the service to read and import into the database. Currently it takes about 10 minutes to go through all the rows of the spreadsheet and convert them to a different format and insert into the database.

The UI is un-usable and shows a loading state until the call returns but it inevitably times out.

If I handle the job on a background worker thread will I be able to return from the service call (while the job is running) and I can tell the user that it is importing and then email them when it's done or something?

The better move would be to save the uploaded files to a queue of some sort first. The queue could be a folder on disk, or could be rows in a database.

Have the WCF service store the uploaded files to the queue. Have a separate service process files from the queue. When it's done with each file, have it flag the file as complete.

Have a separate operation on the WCF service that the client can use to poll whether or not the file is finished (if the client cares).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM