简体   繁体   English

具有wsDualHttpBinding的WCF阻止调用

[英]WCF with wsDualHttpBinding blocking calls

my case is that I'm using wsDualHttpBinding as a binding. 我的情况是我使用wsDualHttpBinding作为绑定。

But I've noticed something kind of unexpected. 但是我注意到了某种意外。 When I try to send a request to a service operation, but my code is handling a callback message (I've put a Thread.Sleep there to simulate), then the service call gets stuck (and can even get timeouted) until the callback message is handled fully. 当我尝试向服务操作发送请求,但是我的代码正在处理回调消息(我在其中放置Thread.Sleep进行模拟)时,服务调用将卡住(甚至可能超时),直到回调消息已完全处理。 Shouldn't they be independent, or the channel can only handle one message at the time, doesn't matter if it's a service request or a callback message? 它们不应该是独立的吗?或者通道一次只能处理一条消息,这是服务请求还是回叫消息都没关系吗? I'm using the same channel all to time, either to receive the callbacks messages or to send out new requests. 我一直在使用相同的频道,以接收回调消息或发出新请求。 This application runs as a service, so there's no UI involved. 此应用程序作为服务运行,因此不涉及UI。

Try 尝试

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]

It is special mode to support callbacks in single-thread configuration. 在单线程配置中支持回调是一种特殊模式。

http://msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx http://msdn.microsoft.com/zh-CN/library/system.servicemodel.concurrencymode.aspx

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

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