System.Net.WebException: Error: NameResolutionFailure when Calling WCF Services throwing exception in mono android application

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.


{System.Net.WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in :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 }

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

and another way

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: 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.

This is working Correctly when i run application on android emulator

Thanks in Advance.. Sreeni


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

  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.

Setting Internet permission to your app and make sure that your device connected with Internet.

Need Your Help

IOS MBProgressHUD display location error(it is not center,the loading display on left top.)

ios objective-c position uiactivityindicatorview mbprogresshud

I use MBProgressHUD showWhileExecuting to query some data from network,but the MBProgressHUD is not center sometimes

Unable to both start and discover a specific service with Wifi Direct

android android-service android-wifi wifi-direct

I'm pretty new with Android programming. But I have been working on this for over a week now, and it starts to get booooring.