问题描述
我是新来的,抱歉我的英语不好。第一次开发Xamarin APP,想调用Web Service。我没有从 Web 服务得到任何结果,但出现以下异常:
ex.InnerException = {System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.sockets.socketException: Connection refused
在 System.Net.sockets.socketAsyncResult.CheckIfThrowDelayedException () [0x00014] 在 /Users/builder/jenkins/workspace/archive-...."
我看了很多 YouTube 视频,上网冲浪了很长时间,但一直没有找到解决方案。
这是我的网络服务:
//web Service from ASMX project
public class WStest : System.Web.Services.WebService {
[WebMethod(MessageName = "Test",Description = "test")]
[System.Xml.Serialization.XmlInclude(typeof(Result))]
public Result test() {
Result result = new Result();
result.msg = "test successful";
result.flag = 1;
result.userNum = "usernummer";
return result;
}
}
这只是 Xamrain 代码的一部分
private void Butsend_Click(object sender,EventArgs e) {
WStest.WStest test = new WStest.WStest();
test.testCompleted += Test_testCompleted;
test.testAsync(); //call Web Service
//throw new NotImplementedException();
}
private void Test_testCompleted(object sender,WStest.testCompletedEventArgs e)
{
try
{
var a = e.Result.msg;
}
catch(Exception ex)
{
Console.WriteLine(ex.InnerException); //here I get the exception
}
}
感谢所有的回答
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)