Linux 上的 EF Core PlatformNotSupported
EF Core PlatformNotSupported on Linux
我正在尝试使用 .NET 6 + EF Core 开发一个小型 Web 应用程序。到目前为止,我已经能够 运行 应用程序,但是当尝试连接到我的 Azure DB 数据库时,它失败并显着抛出 Strings.PlatformNotSupported 异常,如以下堆栈跟踪所示:
System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()
at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.First[TSource](IQueryable`1 source)
at Gepro.Seguimiento.Core.Controllers.UsuariosController.Index() in /home/barclow/Documents/Desarrollo/Gepro.Seguimiento.Core/Controllers/UsuariosController.cs:line 24
at lambda_method18(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
EF Core 与 Linux 兼容吗? - 我记得在 azure 中将这个概念验证部署到 linux docker 并且它起作用了,但不知何故,我无法让它在我的 manjaro linux 上起作用。我知道这不应该是与我安装 linux 有关的问题,因为我能够完美地 运行 网络应用程序。
这个问题显然与.netCore SDK 6.0.100 版本有关,当升级到 SDK 6.0.101 时一切正常。
另外,我有 dotnet 的 AUR 包,所以我不得不删除它,然后按照 this 说明使用官方脚本升级。
curl -sSL https://dot.net/v1/dotnet-install.sh | sudo bash /dev/stdin -c LTS --install-dir /usr/share/dotnet
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
dotnet --list-sdks
# 6.0.101 [/usr/share/dotnet/sdk]
dotnet --list-runtimes
# Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
# Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
我正在尝试使用 .NET 6 + EF Core 开发一个小型 Web 应用程序。到目前为止,我已经能够 运行 应用程序,但是当尝试连接到我的 Azure DB 数据库时,它失败并显着抛出 Strings.PlatformNotSupported 异常,如以下堆栈跟踪所示:
System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()
at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.First[TSource](IQueryable`1 source)
at Gepro.Seguimiento.Core.Controllers.UsuariosController.Index() in /home/barclow/Documents/Desarrollo/Gepro.Seguimiento.Core/Controllers/UsuariosController.cs:line 24
at lambda_method18(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
EF Core 与 Linux 兼容吗? - 我记得在 azure 中将这个概念验证部署到 linux docker 并且它起作用了,但不知何故,我无法让它在我的 manjaro linux 上起作用。我知道这不应该是与我安装 linux 有关的问题,因为我能够完美地 运行 网络应用程序。
这个问题显然与.netCore SDK 6.0.100 版本有关,当升级到 SDK 6.0.101 时一切正常。
另外,我有 dotnet 的 AUR 包,所以我不得不删除它,然后按照 this 说明使用官方脚本升级。
curl -sSL https://dot.net/v1/dotnet-install.sh | sudo bash /dev/stdin -c LTS --install-dir /usr/share/dotnet
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
dotnet --list-sdks
# 6.0.101 [/usr/share/dotnet/sdk]
dotnet --list-runtimes
# Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
# Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]