wcf异常发生在客户端 [英] wcf exception occur in client side

查看:192
本文介绍了wcf异常发生在客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发生以下异常

following exception occur

An exception of type 'System.Reflection.TargetInvocationExcep… occurred in System.ni.dll but was not handled in user code



客户端


client side

private void TrackLocation_Click(object sender, RoutedEventArgs e)
{
ServiceReference1.GetPositionClient client = new ServiceReference1.GetPositionClient();

client.getData1Completed += new EventHandler<servicereference1.getdata1c…>
client.getData1Async(11.1,11.1);

}

void client_getData1Completed(object sender, ServiceReference1.getData1CompletedEvent… e)
{
LongitudeTextBlock.Text = e.Result;
}



服务器端


server side

public class GetPosition : IGetPosition
{
public string getData1(double lat,double lon)
{ return "updated sucessfully"; }
}

推荐答案

似乎异常在服务引用的连线中。如果服务端抛出任何错误并且没有传递给c客户端,则需要输入
It seems that the exception is in the wiring of the service reference. If the service side throws any error and its not getting passed to thec client, you need to put
includeExceptionDetailsInFaults = true

服务器端配置中的serviceDebug属性。



我相信该服务至少会受到客户端的攻击。但是,要调试此方案,请尝试通过浏览器加载您的服务并手动点击该方法。如果它返回正常,则问题出在客户端配置中。通过包含此属性,您可以更清楚地了解正在发生的事情。



同时更新您的服务引用,以确保您拥有wsdl的最新副本,以防您在创建服务引用后更新服务。 />


获得实际的堆栈跟踪后,确定它显示应用程序的点(忽略框架线)并发布那些。

for the serviceDebug attribute in server side configuration.

I believe that the service atleast gets hit by the client. However, to debug this scenario, try to load your service through browser and manually hit the method. If it returns fine, then the issue is in client side configuration. By including this attribute, you can be more clear about what's happening.

Also update your service reference once so that you are sure that you have a latest copy of wsdl just in case you updated the service after creating the service reference.

Once you get the actual stack trace, identify the points where it shows about the application (ignore the framework lines) and the post those.


这篇关于wcf异常发生在客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆