简体   繁体   English

WCF异步调用在Main()中引发Target调用异常

[英]WCF async calls throwing Target invocation exception in Main()

I' developing a WCF client which makes Asynchronous calls to the WCF server. 我正在开发一个WCF客户端,该客户端对WCF服务器进行异步调用。 I'm using .NET 3.5 with Winforms. 我在Winforms中使用.NET 3.5。 My original method is named GetPoints() and I'm using the GetPointsAsync() from the proxy generated by the visual studio 2010 to call the service. 我的原始方法名为GetPoints(),我正在使用Visual Studio 2010生成的代理中的GetPointsAsync()来调用服务。

So far everything was working nicely but the problem comes when the server throws a fault exception. 到目前为止,一切工作正常,但是问题出在服务器抛出故障异常时。 The exception arises in the Main() method --> Application.Run(new Form1()) as "Target invocation exception" :( 该异常在Main()方法-> Application.Run(new Form1())中作为“目标调用异常”出现:

I tried a synchronous method and the exception arises correctly where it should, so the problem is not in the server. 我尝试了一种同步方法,但异常在正确的位置正确出现,因此问题不在服务器中。 Also I've tried to find the InnerException but there is none. 我也试图找到InnerException,但没有。 In fact I cannot even find the targetInvocationException. 实际上,我什至找不到targetInvocationException。 As far as I understand, the exception should arise in the client_GetPointsCompleted() method, isn't it ? 据我了解,该异常应该出现在client_GetPointsCompleted()方法中,不是吗? Is there something else I should take into account ? 还有什么我应该考虑的吗? Where did the exception go ? 例外发生在哪里?

异常应该在传递给client_GetPointsCompleted事件处理程序的GetPointsCompletedEventArgs实例的Error属性中。

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

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