简体   繁体   English

WPF应用程序异步调用WCF服务时出错

[英]Error in WPF application async call to WCF service

I get an unexpected error occasionally when my WPF application calls into my WCF service. 当我的WPF应用程序调用WCF服务时,有时会出现意外错误。 It seems to only occur when I return a larger amount of data. 似乎仅当我返回大量数据时才会发生。 I am essentially making 5 calls to the WCF service and each is returning ~500k of data using binary encoding. 我实质上是对WCF服务进行5次调用,每个调用都使用二进制编码返回〜500k的数据。 However, sometimes I get an error during the deserialization process indicating there was an error deserializing object type. 但是,有时在反序列化过程中会出现错误,指示反序列化对象类型存在错误。 Then it says unexpected prefix and it is some letter p, or l or m, or sometimes it just say unexpected end, etc. 然后说出意外的前缀,它是一些字母p或l或m,或者有时只是说出意外的结尾,等等。

If I close my window and retry sometimes it works. 如果我关闭窗口并重试,有时它会起作用。 If I delete most of the data and try again it works fine until the amount of data grows. 如果我删除了大部分数据,然后重试,则可以正常工作,直到数据量增加为止。 Using fiddler the data all seems to be intact and xml parsers say it is valid. 使用小提琴手,数据似乎都完整无缺,xml解析器说这是有效的。 I have both the client and server bindings set to max int levels to avoid size/length issues but I would have expected to see that a limit was exceeded if that were the case. 我将客户端和服务器绑定都设置为最大int级别,以避免大小/长度问题,但是我希望看到的是超出了限制(如果是这种情况)。 It "appears" that two datasets are overlapping but I am not sure how that is possible. “看起来”两个数据集是重叠的,但是我不确定这是怎么可能的。

If I set max connections down to 2 I do not see this issue but then the app responds much more slowly in all other scenarios. 如果我将最大连接数设置为2,则看不到此问题,但在所有其他情况下,该应用程序的响应速度会慢得多。 Any suggestions on how to further debug a problem like this? 关于如何进一步调试此类问题的任何建议?

Based on what you said, I suggest running a load test without the WCF to isolate the problem. 根据您所说的,我建议在没有WCF的情况下运行负载测试,以找出问题所在。 Also are you hosting the WCF on IIS or local VS Web server? 您是否还在IIS或本地VS Web服务器上托管WCF? Check out this article and read the bottom part about Compression and the Binary Encoder http://msdn.microsoft.com/en-us/library/aa751889.aspx 查看本文,并阅读有关压缩和二进制编码器的底部http://msdn.microsoft.com/zh-cn/library/aa751889.aspx

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

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