Monotouch:WCF服务和异常处理

Lor*_*o B 6 mono wcf asynchronous exception-handling xamarin.ios

我正在使用Visual Studio创建的WCF服务.

我正在调用GetDataAsync(param)这样的调用来检索数据.在GetDataCompleted处理程序中,我正在使用检索到的数据.

服务有效.有时我无法检索数据.在这种情况下,发生如下异常:

Exception in async operation: System.Net.ProtocolViolationException: The number of bytes to be written is greater than the specified ContentLength.
  at System.Net.WebConnectionStream.CheckWriteOverflow (Int64 contentLength, Int64 totalWritten, Int64 size) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnectionStream.cs:546 
Run Code Online (Sandbox Code Playgroud)

怎么可能抓住类似的重复?应用程序仍在工作,但异常在控制台上打印.我认为异常来自Channel或其他东西.

先感谢您.

Dal*_*ale 2

不幸的是,目前 Monotouch 中无法捕获这些 WCF 异常。这似乎是一个已知的错误。请参阅MonoTouch - Silverlight 工具制作的 WCF 服务 - 无法捕获异常