dotnet8 使用mycat 无法打开连接 返回

SqlSugar 沟通中
2 257
该叫什么 土豆 发布于2周前
悬赏:0 飞吻

问题描述:使用mycat中间件,无法打开数据库,报错


SqlSugar.SqlSugarException

  HResult=0x80131500

  Message=中文提示 :  连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:Cannot Open when State is Connecting.DbType="MySql";ConfigId="xlsep".

English Message : Connection open error . Cannot Open when State is Connecting.DbType="MySql";ConfigId="xlsep" 

  Source=SqlSugar

  StackTrace:

   在 SqlSugar.Check.Exception(Boolean isException, String message, String[] args)

   在 SqlSugar.AdoProvider.CheckConnection()

   在 SqlSugar.AdoProvider.Open()

   在 SqlSugar.SqlSugarProvider.Open()

   在 Xl.Tables.SqlSugar.SqlSugarHelper.InitDb() 在 D:\gitlab202411\webapi\Xl.Tables\SqlSugar\SqlSugarHelper.cs 中: 第 273 行

   在 WebApi.Program.<>c__DisplayClass0_0.<Main>b__6() 在 D:\gitlab202411\webapi\WebApi\Program.cs 中: 第 298 行

   在 System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Threading\ExecutionContext.cs 中: 第 192 行


  此异常最初是在此调用堆栈中引发的: 

    SqlSugar.Check.Exception(bool, string, string[])

    SqlSugar.AdoProvider.CheckConnection()

    SqlSugar.AdoProvider.Open()

    SqlSugar.SqlSugarProvider.Open()

    Xl.Tables.SqlSugar.SqlSugarHelper.InitDb() (位于 SqlSugarHelper.cs 中)

    WebApi.Program.Main.AnonymousMethod__6() (位于 Program.cs 中)

    System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, object) (位于 ExecutionContext.cs 中)


热忱回答2

  • 自己已解决,根据文档,连接字符串加上;Pooling=false;  

    0 回复
  •  Cannot Open when State is Connecting  

     这个错是线程安全问题,看文档:偶发

    0 回复