C# Xamarin C:System.Reflection.TargetException

C# Xamarin C:System.Reflection.TargetException,c#,web-services,soap,xamarin,C#,Web Services,Soap,Xamarin,我需要在Xamarin.Forms应用程序中使用WebServiceSOAP。我将webService作为PCL中的服务引用导入 然后我将Web服务称为: //...oncreate Guid g1 = new Guid("3f0c9ec7-9382-403d-8480-7142a7fd65d9"); ws.GetNotificacionesAsync(g1); ws.GetNotificacionesCompleted += ws_GetNotificaciones

我需要在Xamarin.Forms应用程序中使用WebServiceSOAP。我将webService作为PCL中的服务引用导入

然后我将Web服务称为:

  //...oncreate
    Guid g1 = new Guid("3f0c9ec7-9382-403d-8480-7142a7fd65d9");
    ws.GetNotificacionesAsync(g1);
    ws.GetNotificacionesCompleted += ws_GetNotificacionesCompleted;

void ws_GetNotificacionesCompleted(object sender, WSPuentesUsuario.GetNotificacionesCompletedEventArgs e)
            {
                int a = 12;
            }
最后,e显示此错误:Result=System.Reflection.TargetInvocationException:调用的目标已引发异常

INTA=12;仅用于设置断点 PD:我如何使用这个链接作为示例
我发现了这个问题。Xamarin Android需要与HttpGet和HttpPost协议通信。这些协议必须在SideServer上生成。在此表单中添加协议:

最后: System.Reflection.Exception可能由服务器的空响应引起。协议不正确


PD:记住在emulator/device上使用浏览器查看webServicelink webService的正确导航,还记得localhost是指向device/emulator的无效链接。

这通常是服务器上的一个异常-查看InnerException,看看这是否能让您更清楚地了解出错的原因感谢您的回复,但是:如何查看InnerException?请使用调试器-它将是TargetNotificationException上的一个属性。请尝试使用:while e.InnerException!=null e=e.InnerException;GetNotificationsCompletedEventArgs不包含InnerException的定义。InnerException是Exception的属性,而不是EventArgs。使用try-catch块显式捕获异常,或者在抛出异常时使用调试器检查异常