WCF 服务 - 设置 IsOneWay=true 仍然导致等待客户端

问题描述:

对于我的一些服务方法,客户端应用程序不需要等待任何响应发送过来,
所以我只是用 IsOneWay=true 修饰了这些方法,所以它们看起来像:

For seme of my service methods, client application needn't wait for any response to be sent over,
So I just decorated these methods with IsOneWay=true, so they look like:

[OperationContract(IsOneWay=true)]
void MethodName(string param1, int param2)

现在,当我从客户端应用程序调用此方法时,它似乎仍在等待该方法完成处理.

Now, when I call this method from client application, it still seems to wait for the method to complete processing.

我错过了什么吗?

这里可能不是这种情况,我不知道您的特定服务是如何配置的,但是如果您尝试关闭用于调用该方法的通道然后 Close 调用将阻塞,直到服务器上的操作完成 - this 中的更多信息博文.

This may not be the case here and I don't know how your particular service is configured, but if you try and close the channel used to call the method then the Close call will block until the operation has completed on the server - some more info in this blog post.