1、SignalR前端连接失败,出现以下错误

Failed to start the transport 'WebSockets': Error: There was an error with the transport.

问题:Nginx不支持WebSocket
解决方法:需要修改Nginx配置

location /hubroute {
  # Configuration for WebSockets
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_cache off;
  # WebSockets were implemented after http/1.0
  proxy_http_version 1.1;
}

文档:https://docs.microsoft.com/zh-cn/aspnet/core/signalr/scale?view=aspnetcore-5.0#linux-with-nginx

2、HttpClient https请求出现证书问题

The SSL connection could not be established, see inner exception. The remote certificate is invalid according to the validation procedure.

解决方法:将系统证书复制到OpenSSL目录中

cp /etc/pki/tls/cert.pem /usr/local/openssl/

标签: none