本文介绍了WCF ConcurrencyMode = ConcurrencyMode.Multiple不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了以下服务:
I''ve created the following service:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] public class ActivatorService : IActivatorService private bool function() { Thread.Sleep(60000); return false; }我尝试从2-3个客户端调用它,但是直到另一个客户端退出该函数,任何客户端都无法调用该函数. 服务为何不同时调用该方法?
I try to call it from 2 - 3 clients, but no client can call the function until another client exited from it. Why is the service not calling the method concurrently?
推荐答案请看Kenny W的这篇文章 InstanceContextMode,ConcurrencyMode和服务器端线程 [ ^ ].希望对您有所帮助. Take a look at this article from Kenny W InstanceContextMode, ConcurrencyMode, and Server-side Threading[^]. Hope it helps.
通过在其他线程中创建ServiceHost来解决. 在WinForm应用程序中创建主机不允许其使用多线程. Solved by creating the ServiceHost in a different thread. Creating the host in a WinForm application did not allow it to use multithreading.
InstanceContextMode.唯一的问题是将其更改为percall或persession InstanceContextMode.Single is the problem change it to percall or persession
更多推荐
WCF ConcurrencyMode = ConcurrencyMode.Multiple不起作用
发布评论