Brian C
Brian C

Reputation: 111

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

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?

Upvotes: 2

Views: 1034

Answers (1)

zeuz1983
zeuz1983

Reputation: 123

The problem is that your android emulator doesn't trust the self signed certificate of iis express, export the certificate to a file, upload to the emulator and follow this link to add the certificate https://support.google.com/nexus/answer/2844832?hl=en

Upvotes: 2

Related Questions