【发布时间】:2017-10-21 02:25:53
【问题描述】:
我想在“Xamarin 表单”中显示图像,但出现以下错误:
Image Loading: Error getting stream for http://www.example.com/example.jpg *(example only)*: System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
我测试过图片的网址,可以在浏览器上显示。
以下是我在代码隐藏中的代码:
var imageSource = new UriImageSource { Uri = new Uri("http://www.Example.com/example.jpg") } ;
image.Source = imageSource;
下面是我在 Xaml 中使用的代码:
<Image x:Name="image" />
在google了解决方案后,我发现ModernHttpClient可能是一个解决方案,但我不知道如何实现它。
或者不使用 ModernHttpClient 就无法解决错误?
请指教!
【问题讨论】:
-
Error: NameResolutionFailure无论您实际使用的是什么 url,域名都没有解析....
标签: c# xamarin xamarin.forms