iT邦幫忙

0

ASP.NET 网站有时访问出错,过一会访问又正常了,是不是redis的问题呢?

Server Error in '/' Application.
Only one usage of each socket address (protocol/network address/port) is normally permitted IP:端口
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted IP:端口

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SocketException (0x2740): Only one usage of each socket address (protocol/network address/port) is normally permitted IP:端口]
System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port) +702
System.Net.Sockets.Socket.Connect(String host, Int32 port) +162
ServiceStack.Redis.RedisNativeClient.Connect() +133

[RedisException: could not connect to redis Instance at IP:端口]
ServiceStack.Redis.RedisNativeClient.Connect() +1040
ServiceStack.Redis.RedisNativeClient.AssertConnectedSocket() +133
ServiceStack.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs) +31
ServiceStack.Redis.RedisNativeClient.SendExpectInt(Byte[][] cmdWithBinaryArgs) +18
ServiceStack.Redis.RedisClient.ContainsKey(String key) +9

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
暐翰
iT邦大師 1 級 ‧ 2018-08-29 09:08:57
最佳解答

是不是redis的问题呢?

[RedisException: could not connect to redis Instance at IP:端口]

redis有連線數量上限,超過上限取不到connection物件
樓主有對redis設timeout時間?

另外假如可以共用的情況
不需要每次set get都去開一個新的connection

谢谢,我检查了代码,修复了这个问题。没有设置timeout,不过是每次都是 开 一个连接了。

我要發表回答

立即登入回答