我在xamarin中是全新的。xamarin PCL消耗WCF:Android中未處理的異常
我使用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清單所有權限都cheched。 Android模擬器連接到互聯網...
每一個幫助將非常感謝!在此先感謝......並請原諒我的英語。
Android中發生了什麼異常? – Jason
我不知道...: - ((( 只彈出一個窗口:「未處理的異常出現」 沒有裁判 – treep
命中打破 - 然後使用調試器來看看異常和堆棧跟蹤 – Jason