简体   繁体   中英

Xamarin : display image stored on local IIS server

I am implementing a Xamarin application for Android and a Web application ASP.NET. The Xamarin app consumes services of the Web app. Currently, the IIS server is running locally on my PC and I am testing the Xamarin app on my own device (not an emulator). 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.

Everything works fine, the Xamarin app can consume the Web services. Among other, the Xamarin App sends images to the server, which stores them locally in a folder named "Uploads".

The problem I am facing is displaying those images in my Xamarin application. 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 . The server URL is good and so is the path. If i copy past this into a browser on my PC or my smartphone, I get the image. But into my Xamarin app the images are not displaying. 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. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> 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 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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