简体   繁体   中英

WCF async calls throwing Target invocation exception in Main()

I' developing a WCF client which makes Asynchronous calls to the WCF server. I'm using .NET 3.5 with Winforms. 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.

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" :(

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. In fact I cannot even find the targetInvocationException. As far as I understand, the exception should arise in the client_GetPointsCompleted() method, isn't it ? Is there something else I should take into account ? Where did the exception go ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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