WCF ConcurrencyMode = ConcurrencyMode.Multiple不起作用 [英] WCF ConcurrencyMode = ConcurrencyMode.Multiple is not working

查看:146
本文介绍了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的这篇文章 ^ ].希望对您有所帮助.
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不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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