首页 > 解决方案 > SignalR 与服务器的连接问题

问题描述

所以我最近买了一个vps来在我的项目中尝试SignalR,我用了这个例子:Simple SignalR Project

不幸的是,虽然我对此类事情没有任何经验,但我在我的 vps 上上传了 ServerSide 程序并尝试与之连接,但我收到以下错误:An error occurred while sending the request. 更详细:

   System.Net.Http.HttpRequestException' in mscorlib.dll
   System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ip:9080
   at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) / System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ip:9080
   at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

所以我想知道我是否在这里做错了什么,或者需要在我的服务器上进行任何特定的设置/设置

顺便说一句,我的目标是与服务器建立连接并为我的项目获取实时数据,所以如果有更好的选择,不胜感激

标签: c#signalr

解决方案


好吧,找到了解决方案,我的防火墙阻止了连接


推荐阅读