简体   繁体   English

Xamarin:显示存储在本地 IIS 服务器上的图像

[英]Xamarin : display image stored on local IIS server

I am implementing a Xamarin application for Android and a Web application ASP.NET.我正在为 Android 和 Web 应用程序 Z9E0DA8438E1E38A1C30F4B76CE7 实施 Xamarin 应用程序。 The Xamarin app consumes services of the Web app. Xamarin 应用使用 Web 应用的服务。 Currently, the IIS server is running locally on my PC and I am testing the Xamarin app on my own device (not an emulator).目前,IIS 服务器在我的 PC 上本地运行,我正在我自己的设备(不是模拟器)上测试 Xamarin 应用程序。 To be able to access the server from my smartphone, I have installed Conveyor in Visual Studio which allows remote access to development web server.为了能够从我的智能手机访问服务器,我在 Visual Studio 中安装了 Conveyor,它允许远程访问开发 web 服务器。

Everything works fine, the Xamarin app can consume the Web services.一切正常,Xamarin 应用程序可以使用 Web 服务。 Among other, the Xamarin App sends images to the server, which stores them locally in a folder named "Uploads".其中,Xamarin 应用程序将图像发送到服务器,服务器将它们存储在本地名为“Uploads”的文件夹中。

The problem I am facing is displaying those images in my Xamarin application.我面临的问题是在我的 Xamarin 应用程序中显示这些图像。 First, I ask to the server the images path which are stored into a database.首先,我向服务器询问存储到数据库中的图像路径。 The paths I get are good and are like: https://192.168.1.25:45455/Uploads/myImage.jpg .我得到的路径很好,就像: https://192.168.1.25:45455/Uploads/myImage.jpg The server URL is good and so is the path.服务器 URL 很好,路径也很好。 If i copy past this into a browser on my PC or my smartphone, I get the image.如果我将其复制到我的 PC 或智能手机上的浏览器中,我会得到图像。 But into my Xamarin app the images are not displaying.但是在我的 Xamarin 应用程序中,图像没有显示。 In the console I have the following error:在控制台中,我有以下错误:

Image Loading: Error getting stream for https://192.168.1.25:45455/Uploads/myImage.jpg : System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. Image Loading: Error getting stream for https://192.168.1.25:45455/Uploads/myImage.jpg : System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.Security.Authentication.AuthenticationException:身份验证失败,请参阅内部异常。 ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/boringssl/ssl/handshake_client.c:1132 ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED at /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/boringssl/ssl/handshake_client .c:1132

I guess it is a certificate issue, but I don't understand why it is not working in this case and everything works fine when I consume web services with the same server URL: https://192.168.1.25:45455/api/MyService . I guess it is a certificate issue, but I don't understand why it is not working in this case and everything works fine when I consume web services with the same server URL: https://192.168.1.25:45455/api/MyService .

I have tried several things but did not succeed to make it works.我尝试了几件事,但未能成功。

I have fixed it now.我现在已经修好了。 It was indeed a certificate issue due to conveyor.由于传送带,这确实是证书问题。 To fix it, just follow those steps: https://conveyor.cloud/help/ssl .要修复它,只需按照以下步骤操作: https://conveyor.cloud/help/ssl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM