locked
Connecting to a locally running SignalR .netcore server via android emulator RRS feed

  • Question

  • User413492543 posted

    I have a .netcore SignalR server running locally through ISS express. (https://localhost:44372/secureChat")

    I have an Android Emulator running through Android Studio.

    For referencing localhost things via the emulator you use the ip 10.0.2.2.

    I'm using the microsoft signalR android package: com.microsoft.signalr:signalr

    I using the hubConnectionBuilder to connect to: https://10.0.2.2:44372/secureChat

    When I attempt to connect I get the following error: java.lang.RuntimeException: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

    I've found solutions online but none of them relate to SignalR or socket connections. 

    Alternatively I also have a website that connects to the local signalR server and when I launch the website locally and then host that inside a WebView in android app, it works fine (webview connected at https://10.0.2.2:3000) , but I'm trying to experiment with connecting directly from Android without the webview.

    Does anybody have any idea what I need to do to resolve this issue?

    Thanks,

    Brian

    Monday, February 18, 2019 8:01 PM

All replies

  • User475983607 posted

    The android app must connect to the IP:PORT that SignalR is running on.   

    Tuesday, February 19, 2019 12:08 AM
  • User283571144 posted

    Hi BrianChesbrough,

    When I attempt to connect I get the following error: java.lang.RuntimeException: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

    According to the error message, it seems you don't enable the trust all certificates in java Android application or create a custom SSLSocketFactory that trusts only your certificate.

    I suggest you could try to follow below answer to know how to solve this issue.

    https://stackoverflow.com/a/6378872/7609093 

    Best Regards,

    Brando

    Tuesday, February 19, 2019 2:43 AM