WP7中EndpointNotFoundException的异常捕获

oubenruing 2013-09-22 01:15:22
WP7调用webservice时服务端未启动会报错。
“System.ServiceModel.EndpointNotFoundException”类型的未经处理的异常在 System.ServiceModel.dll 中发生 。
因此想添加EndpointNotFoundException的异常捕获,但是不知道怎么捕获这里的异常求指点。


servicePortTypeClient client=new servicePortTypeClient();
client.initAsync();
client.initcomleted+=(s,e)=>
{
MessageBox.Show(e.Result.Message.ToString());
}
...全文
579 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
oubenruing 2013-09-22
  • 打赏
  • 举报
回复
引用 8 楼 cuit 的回复:
你这是为了测试异常case?
也不是 因为我初始化程序的时候需要连接webservice获取数据 如果连接失败我想要得到连接失败的消息 目前就想到捕获异常来得到连接失败的消息 结果这个还捕获不了异常。。纠结呀
gnimgnot 2013-09-22
  • 打赏
  • 举报
回复
你这是为了测试异常case?
oubenruing 2013-09-22
  • 打赏
  • 举报
回复
引用 6 楼 cuit 的回复:
[quote=引用 5 楼 oubenruing 的回复:] [quote=引用 4 楼 cuit 的回复:] 你把这些都try catch住试试 client.initAsync(); client.initcomleted+=(s,e)=> { MessageBox.Show(e.Result.Message.ToString()); }
试过了···没用。。。依然报错[/quote] 你服务器开了的时候是什么情况?[/quote] 开了就正常运行了= = 弹出messagebox 显示消息···
gnimgnot 2013-09-22
  • 打赏
  • 举报
回复
引用 5 楼 oubenruing 的回复:
[quote=引用 4 楼 cuit 的回复:] 你把这些都try catch住试试 client.initAsync(); client.initcomleted+=(s,e)=> { MessageBox.Show(e.Result.Message.ToString()); }
试过了···没用。。。依然报错[/quote] 你服务器开了的时候是什么情况?
oubenruing 2013-09-22
  • 打赏
  • 举报
回复
引用 4 楼 cuit 的回复:
你把这些都try catch住试试 client.initAsync(); client.initcomleted+=(s,e)=> { MessageBox.Show(e.Result.Message.ToString()); }
试过了···没用。。。依然报错
gnimgnot 2013-09-22
  • 打赏
  • 举报
回复
你把这些都try catch住试试 client.initAsync(); client.initcomleted+=(s,e)=> { MessageBox.Show(e.Result.Message.ToString()); }
oubenruing 2013-09-22
  • 打赏
  • 举报
回复
引用 1 楼 cuit 的回复:
EndpointNotFoundException 意思是找不到服务器...
求助
oubenruing 2013-09-22
  • 打赏
  • 举报
回复
对啊 服务器端我没开啊 由于远程终结点关闭、远程终结点无法访问,或者由于远程网络无法访问,因此可能找不到或无法访问终结点。 实际运行中也会有服务器端关闭的情况吧。我肯定不能让程序莫名其妙的退出啊。。 求助怎么try catch一下。。
gnimgnot 2013-09-22
  • 打赏
  • 举报
回复
EndpointNotFoundException 意思是找不到服务器...

7,656

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧