Gab*_*oza 2 linux entity-framework entity-framework-core .net-core asp.net-core
我正在尝试使用.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()
Run Code Online (Sandbox Code Playgroud)
EF Core 与 Linux 兼容吗?- 我记得将这个概念验证部署到 azure 中的 Linux docker 上并且它有效,但不知何故,我无法让它在我的 manjaro linux 上工作。我知道这不应该是与我安装 Linux 相关的问题,因为我能够完美运行该网络应用程序。
这个问题显然与 SDK 6.0.100 版本的 .netCore 有关,升级到 SDK 6.0.101 时一切正常。
另外,我有 dotnet 的 AUR 包,所以我必须将其删除,然后按照此说明使用官方脚本进行升级。
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]
Run Code Online (Sandbox Code Playgroud)