WCF 客户端挂起响应 [英] WCF client hangs on response

查看:31
本文介绍了WCF 客户端挂起响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个指向 WebSphere 服务的 WCF 客户端(在 Win7 上运行).

I have a WCF client (running on Win7) pointing to a WebSphere service.

测试工具(我的网络应用程序外的一个小测试装置)一切都很好,但是当我对服务的调用来自我的网络项目时,其中一个调用(并且只有那个)反序列化非常慢(需要分钟 VS 秒)并且不仅仅是第一次.

All is good from a test harness (a little test fixture outside my web app) but when my calls to the service originate from my web project one of the calls (and only that one) is extremely slow to deserialize (it takes minutes VS seconds) and not just the first time.

我可以从 fiddler 看到响应很快返回,但是 WCF 客户端在响应本身挂起超过一分钟,在调试器命中下一行代码之前,几乎如果客户端在反序列化时遇到问题.只有在响应中我有一个给定的 pdf 字符串(操作生成一个 pdf),base64 编码分块时才会发生这种情况.例如,如果服务引发错误(因此 pdf 字符串不存在),则响应会立即反序列化.

I can see from fiddler that the response comes back quickly but then the WCF client hangs on the response itself for more than a minute before the next line of code is hit by the debugger, almost if the client was having trouble deserializing. This happens only if in the response I have a given pdf string (the operation generates a pdf), base64 encoded chunked. If for example the service raises a fault (thus the pdf string is not there) then the response is deserialized immediately.

同样,如果我通过 Soap-UI 或从 Web 项目外部发送完全相同的信封,一切都很好.

Again, If I send the exact same envelope through Soap-UI or from outside the web project all is good.

我不知所措 - 我应该寻找什么,是否有一些配置设置可以解决问题?

I am at loss - What should I be looking for and is there some config setting that might do the trick?

感谢任何帮助!

编辑:

我根据同一个服务合同编写了一个存根.使用完全相同的 basicHttpBinding 并返回完全相同的 pdf 字符串,没有延迟注册.我认为这排除了字符串和绑定作为可能的原因.还剩下什么?

I coded a stub against the same service contract. Using the exact same basicHttpBinding and returning the exact same pdf string there is no delay registered. I think this rules out the string and the binding as a possible cause. What's left?

推荐答案

在绑定上将 transferMode="Buffered" 更改为 transferMode="Streamed" 就成功了!

Changing transferMode="Buffered" into transferMode="Streamed" on the binding did the trick!

因此,有效载荷显然被分成了缓冲区大小的小块.

So the payload was apparently being chunked in small bits the size of the buffer.

我认为通过增加缓冲区大小 (maxBufferSize="1000000") 也可以实现同样的效果,但我已经有了它,但没有帮助.

I thought the same could have been achieved by increasing the buffersize (maxBufferSize="1000000") but I had that in place already and it did not help.

这篇关于WCF 客户端挂起响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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