.net 6 , sql sugar , sql server 2016 ,连接数超过200,提示以下错误,重启IIS里面的网站就正常了

独孤薄荷 2024-10-15 16:47:54

SqlSugar.SqlSugarException: 中文提示 :  连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,实在找不到原因请先Google错误信息:Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached..
English Message : Connection open error . Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
   at SqlSugar.AdoProvider.GetDataReader(String sql, SugarParameter[] parameters)
   at SqlSugar.QueryableProvider`1.GetData[TResult](KeyValuePair`2 sqlObj)
   at SqlSugar.QueryableProvider`1._ToList[TResult]()
   at SqlSugar.QueryableProvider`1.ToList()
   at SqlSugar.QueryableProvider`1.Single()
   at SqlSugar.QueryableProvider`1.Single(Expression`1 expression)
   at lambda_method613(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

...全文
194 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
吉普赛的歌 2024-10-18
  • 打赏
  • 举报
回复

查一下连接串的连接池配置吧

独孤薄荷 2024-10-27
  • 举报
回复
@吉普赛的歌 谢谢,是数据池满了
tigerleq 2024-10-18
  • 打赏
  • 举报
回复

一般访问数据的插件,我们都会 在中间加一个 壳,或者说加一个类统一管理 访问 数据,不会直接使用插件,否这后期 发现 ,插件问题,要切换插件,或者优化访问 数据库,你将会非常的痛苦

独孤薄荷 2024-10-27
  • 举报
回复
@tigerleq 怎么加壳的
tigerleq 2024-10-18
  • 打赏
  • 举报
回复

执行了语句,要释放连接。尤其使用 Npgsql 这些 东西,在执行事务时,一定要管理好 链接的打开与关闭。

独孤薄荷 2024-10-27
  • 举报
回复
@tigerleq 默认是关闭的,但是数据库有特性,有些链接会复用

111,122

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧