System.Net.WebException:错误:NameResolutionFailure调用WCF服务的单声道Android应用程序抛出异常时, [英] System.Net.WebException: Error: NameResolutionFailure when Calling WCF Services throwing exception in mono android application

查看:3283
本文介绍了System.Net.WebException:错误:NameResolutionFailure调用WCF服务的单声道Android应用程序抛出异常时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作单的Andr​​oid手机应用程序了。我打电话给我的WCF服务在我的应用程序了,我加了WCF服务的使用 - >添加项目菜单WebRefernce选项。我的问题是我得到的例外,当我运行在设备上调用WCF服务。

I am working on Mono Android Mobile applicaiton. I am calling my WCF Services in my applicaiton, I added wcf services using ->Add WebRefernce option of Project Menu. My Problem is I am getting exception when i am running the calling the wcf services on the device.

异常

Exception:

{System.Net.WebException:错误:NameResolutionFailure在   System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult的   asyncResult)[0x00000]中:0

{System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in :0

在System.Net.HttpWebRequest.GetRequestStream()[0x00000]中   :0的   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke   (System.String方法_,System.Object的[]参数)[0x00000]中   :0}

at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in :0 at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in :0 }

我的设备具有使用WiFi连接来获取和互联网连接后的数据

My device has internet connection using WiFi connection to get and post data

和另一种方式

我尝试使用使用移动数据即与移动网络提供商的互联网连接。这一次我得到一个不同的异常净连接调用服务。

I tried calling the services using the net connection using Mobile Data i.e with the Mobile NetWork Provider's internet connection.. This time i am getting a different exception..

{System.Net.WebException:请求失败,HTTP状态404:   NOTFOUND在   System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse   (System.Net.WebResponse响应,   System.Web.Services.Protocols.SoapClientMessage消息,   System.Web.Services.Protocols.SoapExtension []扩展)[0x00000]中   :0的   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke   (System.String方法_,System.Object的[]参数)[0x00000]中   :0的   AndroidWCFExample.WirelessService.SAGServer.ProcessSomeUpdate   (AndroidWCFExample.WirelessService.WebServicesClient oClientInfo,   System.String信息参数)[0x00001]在C:\有些DOTNET   举例\ AndroidWCFExample \ AndroidWCFExample \ WEB   在(1232封装参考文献:\ WirelessService \ Reference.cs   远程处理调用,以检查)   AndroidWCFExample.WirelessService.SAGServer:ProcessSomeUpdate   (AndroidWCFExample.WirelessService.WebServicesClient,字符串)在   AndroidWCFExample.EmployeeInfoActivity.button_Click(System.Object的   发件人,发送System.EventArgs)0x0007a]在C:\有些DOTNET   举例\ AndroidWCFExample \ AndroidWCFExample \ EmployeeInfoActivity.cs:79   }

{System.Net.WebException: The request failed with HTTP status 404: NotFound at System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse (System.Net.WebResponse response, System.Web.Services.Protocols.SoapClientMessage message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x00000] in :0 at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in :0 at AndroidWCFExample.WirelessService.SAGServer.ProcessSomeUpdate (AndroidWCFExample.WirelessService.WebServicesClient oClientInfo, System.String ParameterInfo) [0x00001] in C:\Some Dotnet Examples\AndroidWCFExample\AndroidWCFExample\Web References\WirelessService\Reference.cs:1232 at (wrapper remoting-invoke-with-check) AndroidWCFExample.WirelessService.SAGServer:ProcessSomeUpdate (AndroidWCFExample.WirelessService.WebServicesClient,string) at AndroidWCFExample.EmployeeInfoActivity.button_Click (System.Object sender, System.EventArgs e) [0x0007a] in C:\Some Dotnet Examples\AndroidWCFExample\AndroidWCFExample\EmployeeInfoActivity.cs:79 }

我正在寻找解决方案来解决这个问题,但没有得到正确的答案。 所以,请让我知道什么,我需要做的,得到它固定。请帮我。

I am searching for solution to fix this, but not getting correct answer. So Please let me know what i need to do, to get it fixed. Please help me out.

这是工作正常,当我运行在Android模拟器的应用程序

This is working Correctly when i run application on android emulator

在此先感谢.. Sreeni

Thanks in Advance.. Sreeni

推荐答案

我知道这是一个古老的职位,但面临着同样的错误,所以想分享的解决方案。

I know this is an old post, but was facing the same error, so thought to share the solution.

  1. 我发现最好的解决办法,如果发生了异常,而无线 相连,只是重试我的服务器调用,在轻微的睡眠 之间。它工作的大部分时间,否则,如果第二呼叫 失败我取消请求。
  2. 此错误也可以提高,如果用户的无线很不稳定或 信号是很低的。如果没有互联网,会出现相同的错误 连接可言,即使连接到无线网络。
  1. The best solution I found, when that exception occurs while the Wifi is connected, is just to retry my server call with a slight sleep in between. It works most of the time, otherwise if the second call fails I cancel the request.
  2. This error can also raise if the user's Wifi is very unstable or the signal is very low. The same error occurs if there is no internet connection at all, even if connected to Wifi.

这篇关于System.Net.WebException:错误:NameResolutionFailure调用WCF服务的单声道Android应用程序抛出异常时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆