Internal connection fatal error
错误信息
mssql数据库的一个错误。打开mssql数据库连接的时候会报出这个错误。
System.InvalidOperationException
HResult=0x80131509
Message=Internal connection fatal error.
Source=System.Data.SqlClient
StackTrace:
--一大段错误信息就不在这里贴了。
环境检查
数据库是mssql 2019。
语言是NET 8.
项目类型是 .NET WebAPI。
排查问题
首先排除了代码问题。连接数据库代码复用到其他项目里面完全没有问题。
using System;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string connectionString =
"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;";
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
Console.WriteLine("Connected to the database.");
// 在这里执行你的数据库操作
connection.Close();
}
}
}
同一个链接字符串放到这个代码里面也没有问题。
于是我怀疑是这个类库的bug。
用了3个小时。我在github,得到了这个问题的解决方法。
System.InvalidOperationException: Internal connection fatal error. Error state: 15, Token : 143 #919
解决方法
我至今不明白的解决方案,如果有哪位大佬知道请告诉我。
解决方法如下。
找到项目的csproj文件,没错就是项目文件。把下面文件里面的第6行删掉就行。
对删掉一个标签InvariantGlobalization就行了,一切正常了。
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>
- connection Internal fatal errorconnection internal fatal error directory fatal error file fatal error pcre2 found directory fatal error zlib directory fatal error bzlib directory osmesa fatal error directory bam2wig fatal error github github-fatal-unable-to-access-htt ps-github-com-failed-to-connect-t broken stdout fatal error cataloging backups fatal error