HttpWebRequest NameResolutionFailure exception in .NET (with Mono on Ubuntu)

前端 未结 5 1401
我寻月下人不归
我寻月下人不归 2021-01-01 20:14

I have a .NET program running on Ubuntu via Mono 2.10

The program downloads a webpage via an HttpWebRequest every minute or so which works fine most of the time:

5条回答
  •  遥遥无期
    2021-01-01 20:53

    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.

    This is in line with my ans on :

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

提交回复
热议问题