开发者

Calling Close() on Service Proxy blocks after One Way WCF call

I have a simple Fire and Forget service operation that works fine and doesn't block. However, when I try to close the service proxy, it will block until the one-way call completes. Is this expected behavior?

Client Code:

var serviceProxy = new MyServiceProxy();
serviceProxy.OneWayCall();
serviceProxy.Close();  // This blocks until OneWayCall() is finished.

Service:

[ServiceContract]
public interface IMyService {
   [OperationContract(IsOneWay = true)]
   void OneWayCall();
}

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MyService : IMyService {
   public void OneWa开发者_运维知识库yCall() {
      // Stuff and things
   }
}


Yes - depending on the binding/configuration your service is using and if you are using sessions in any way. See the below link for information on configurations that lead to blocking:

WCF Best Practice #5: One-way is not always really one-way

Hope that helps


For completeness' sake; here is what Microsoft has to say about this behavior:

Clients Blocking with One-Way Operations

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜