tags:

views:

18

answers:

1

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 OneWayCall() {
      // Stuff and things
   }
}
+1  A: 

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

Tanner
Yeah, I found this earlier, and I've been configuring accordingly, but I'm getting other issues... which I may post here again. This is a good post, though.
Chris Dwyer