简体   繁体   English

大量导入作业到WCF服务导致超时

[英]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. 我有一个很大的Excel电子表格,我需要将其转换并导入到sql server数据库中。 I'm using a Silverlight front end which basically sends the file to the service to read and import into the database. 我使用的是Silverlight前端,该前端基本上将文件发送到服务以读取并导入数据库。 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. 当前,浏览电子表格的所有行并将其转换为其他格式并插入数据库大约需要10分钟。

The UI is un-usable and shows a loading state until the call returns but it inevitably times out. UI无法使用,并显示加载状态,直到调用返回,但不可避免地超时。

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. 让WCF服务将上传的文件存储到队列中。 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). 对WCF服务进行单独的操作,客户端可以用来轮询文件是否完成(如果客户端需要的话)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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