WCF线程 - 无响应的用户界面 [英] WCF threading - non-responsive UI

查看:300
本文介绍了WCF线程 - 无响应的用户界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置一些WCF的东西。目前,我有一个服务器,它允许远程用户下载文件,和客户端。 在服务器中,我使用了一个ServiceHost的类。我认为它应该运行在一个独立的线程,但是,服务器的用户界面(的WinForms),当有人下载​​一个文件被锁定。有没有一种方法来管理WCF线程模型?

I'm trying to configure some WCF stuff. Currently, I have a server which allows remote users to download files, and client. In the server, I use a ServiceHost class. I assume it should be running on a separate thread, however, the server UI (WinForms) becomes locked when someone downloads a file. Is there a way to manage the WCF threading model?

感谢您!

推荐答案

从,如果你是在启动UI线程之前,它可以运行在它自己的线程来构造ServiceHost的实例相同的Windows窗体应用程序,这意味着工作线程从线程池进程的消息,而不是消息循环分配的。因此,服务才能真正处理多个并发请求。

"From the same Windows Form application if you were to construct the ServiceHost instance before starting the UI thread, it will run on its own thread. That means worker threads allocated from the thread pool process messages instead of the message loop. Thus, services can truly process multiple concurrent requests. "

这篇关于WCF线程 - 无响应的用户界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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