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

前端 未结 5 1407
我寻月下人不归
我寻月下人不归 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:38

    Well I use the HttpClient - but it might be a similar problem. I had the same issue on a Android device (it worked on a Windows Phone)... But after I added the Host to the header it worked!

    client.DefaultRequestHeaders.Host = "mydomain.com";

    You can still use the name in the url (you don't have to use the IP address)

提交回复
热议问题