问题
I'm trying to use SocketIO4Net to connect with my node.js server via socket.io.
Can't seem to get it to work, when it comes to HTTPS. Getting this: Error initializing handshake with https://localhost/
Couldn't find a solution in other similar questions. If you have other solutions to connect to socket.io sockets from C# feel free to share the information.
回答1:
.NET seems to block my self signed certificate. Implementing the RemoteCertificateValidationCallback seems to solve the problem.
ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(pass);
private static bool pass(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) { return true; }
来源:https://stackoverflow.com/questions/36792240/socketio4net-error-initializing-handshake-with-https-localhost