【发布时间】:2017-04-27 12:43:13
【问题描述】:
我是 xamarin 的新手。
我使用 Visual Studio 2017 社区并编写了一个非常简单的代码:我想连接到一个基本的 WCF 服务。
服务链接:
http://services.adserviceitalia.it/Service1.svc
(GetHello方法,输入字符串和返回字符串...非常基本的方法)
我阅读了很多示例...我添加了对服务的引用,生成代理类...好的!!
public partial class MainPage : ContentPage
{
private wcfs.Service1Client ws;
public MainPage()
{
InitializeComponent();
var endpoint = new EndpointAddress("http://services.adserviceitalia.it/Service1.svc");
var binding = new BasicHttpBinding
{
Name = "basicHttpBinding",
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};
TimeSpan timeout = new TimeSpan(0, 0, 30);
binding.SendTimeout = timeout;
binding.OpenTimeout = timeout;
binding.ReceiveTimeout = timeout;
ws = new wcfs.Service1Client(binding,endpoint);
ws.GetHelloCompleted += Handle_HelloWorldCompleted;
}
private void Button_Clicked(object sender, EventArgs e)
{
ws.GetHelloAsync("Mark");
}
private void Handle_HelloWorldCompleted(object sender, wcfs.GetHelloCompletedEventArgs args)
{
label1.Text = args.Result;
}
}
}
它在 UWP 调试中工作...
Connection with WCF... Hello World working in UWP
我在 Android 中遇到了一个未处理的异常...
在 Android Manifest 中检查所有权限。 Android 模拟器已连接到互联网...
我们将不胜感激任何帮助!!在此先感谢...请原谅我的英语。
【问题讨论】:
-
Android出现什么异常?
-
我不知道... :-((( 仅出现一个窗口:“发生未处理的异常”没有参考文献
-
打断 - 然后使用调试器查看异常和堆栈跟踪
-
我无法完成这项任务。异常触发: ws.GetHelloAsync("Mark");我可以制作一些屏幕截图......但信息不足:-( imgur.com/a/zuxrT
-
您需要学习如何使用调试器。检查 Exception 对象应该可以让您看到服务器返回的异常 - 可能在 InnerException 属性中
标签: c# wcf xamarin.android xamarin.forms visual-studio-2017