【发布时间】:2023-03-16 15:41:02
【问题描述】:
我正在使用 xamarin.forms 中的 WCF 肥皂网络服务。我添加了来自生成异步操作的 Visual Studio 的服务引用。我使用以下代码来使用 Web 服务
Service1Client dataCommunicator = new Service1Client();
dataCommunicator.GiveFeedbackCompleted += new EventHandler<GiveFeedbackCompletedEventArgs>(GiveFeedbackCallback);
dataCommunicator.GiveFeedbackAsync(editPhoneF.Text, monuments[pickerMonument.SelectedIndex], editRemarks.Text, imei);
}
private async void GiveFeedbackCallback(object sender, GiveFeedbackCompletedEventArgs e)
{
if (e.Result)
{
await DisplayAlert("Success", "Thank you for your valuable comments", "Ok");
}
else
{
await DisplayAlert("Oops!!", "Internal server error, please try again later", "Ok");
}
}
当我在模拟器上测试它时,我只是坐着等待回复,当我尝试使用像安卓手机这样的手机时,就会出现错误,即 targetinvocationexception。 我应该怎么做才能解决这个问题?
【问题讨论】:
标签: c# web-services wcf xamarin.ios xamarin.forms