即使关闭我的wcf连接,如何处理记录 [英] How to process records even if close my wcf connection

查看:88
本文介绍了即使关闭我的wcf连接,如何处理记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我是WCF的新手。我有一批。在一个批次中我有很多记录。首先,我调用服务并将记录信息存储在我的数据库中,并将Db存储状态提供给客户端。



一旦我返回状态,我需要关闭wcf连接。之后我需要异步处理这些记录。客户端不需要等到我处理所有记录。



提前致谢。



谢谢和问候



Vishnu

Hello,
I am new to WCF. I have a batch. In one batch I have many records. First I am calling the service and storing records information in my DB and giving Db storing status to client.

Once I return the status, I need to close wcf connection. After that I need to process those records asynchronously. Client doesn''t need to wait until I process all the records.

Thanks in advance.

Thanks and Regards

Vishnu

推荐答案

我不建议您在仍有数据处理时关闭连接...



在客户端创建一个在后台等待的线程直到在服务器端处理所有记录,然后调用消息(例如状态栏标签)向用户显示处理成功是IMO更好的处理方式。



使用我建议的方法解决这个问题时你有一些主要优势:

- 用户可以继续工作

- 用户保持最新状态如果处理成功与否(请记住,当您使用WCF和/或数据库时总是有可能失败)。



唯一可能的事情需要添加的是一个逻辑,它不允许用户在服务器处理数据时关闭你的应用程序(或者dis在关闭客户端应用程序之前发出警告消息。)



我只是写了一篇关于这个主题的文章的好主意。谢谢!

如果您希望我完成后可以通知您:-)。



欢呼,

Marco Bertschi
I would not recommend you to close the connection while there is still data being processed...

Creating a thread on the client side who waits in the background until all the records are processed at the server side and then invokes a message (e.g. a status bar label) to show the user that the processing was successful is IMO the better way to handle this.

You have certain main advantages when solving this with my suggested method:
- The user can continue working
- The user stays up-to-date if the processing was successfull or not (remember that there is always a possibility to fail when you are working with WCF and / or databases).

The only thing you might need to add is a logic which does not allow the user to close your app while the server is still processing data (Or display a warning message before closing the client app).

I just had the great idea of writing an article about this topic. Thank you!
If you wish to I can let you know when I am done with it :-).

cheers,
Marco Bertschi


这篇关于即使关闭我的wcf连接,如何处理记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆