Internal connection fatal error
錯(cuò)誤信息
mssql數(shù)據(jù)庫(kù)的一個(gè)錯(cuò)誤。打開mssql數(shù)據(jù)庫(kù)連接的時(shí)候會(huì)報(bào)出這個(gè)錯(cuò)誤。
System.InvalidOperationException
HResult=0x80131509
Message=Internal connection fatal error.
Source=System.Data.SqlClient
StackTrace:
--一大段錯(cuò)誤信息就不在這里貼了。
環(huán)境檢查
數(shù)據(jù)庫(kù)是mssql 2019。
語(yǔ)言是NET 8.
項(xiàng)目類型是 .NET WebAPI。
排查問題
首先排除了代碼問題。連接數(shù)據(jù)庫(kù)代碼復(fù)用到其他項(xiàng)目里面完全沒有問題。
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.");
// 在這里執(zhí)行你的數(shù)據(jù)庫(kù)操作
connection.Close();
}
}
}
同一個(gè)鏈接字符串放到這個(gè)代碼里面也沒有問題。
于是我懷疑是這個(gè)類庫(kù)的bug。
用了3個(gè)小時(shí)。我在github,得到了這個(gè)問題的解決方法。
System.InvalidOperationException: Internal connection fatal error. Error state: 15, Token : 143 #919
解決方法
我至今不明白的解決方案,如果有哪位大佬知道請(qǐng)告訴我。
解決方法如下。
找到項(xiàng)目的csproj文件,沒錯(cuò)就是項(xiàng)目文件。把下面文件里面的第6行刪掉就行。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-760484.html
對(duì)刪掉一個(gè)標(biāo)簽InvariantGlobalization就行了,一切正常了。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-760484.html
<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>
到了這里,關(guān)于Internal connection fatal error的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!