I have been trying to add Authentication to an ASP.NET Core 5 web application without succes. I am following exactly the instructions in your website: https://www.devart.com/dotconnect/postg ... 1632412803
I have the following versions of Devart:
- Devart.Data.dll: 5.0.2697.0
- Devart.Data.PostgreSql.dll: 7.20.1905.0
install-package Devart.Data.PostgreSql.EFCore
(I also tried running the command to get the latest version)
Every step is done without errors until I reach the end, update-database.
This is the appsettings.json file with the connection string (DefaultConnection)
Code: Select all
{
"ConnectionStrings": {
"Anonymous": "host=localhost;database=testwithoutusers;schema=testwithoutusers;port=5432;user id=anonymous;password=anonymous;License Key=n7UBDBU7VZ2bJ2bnpFvq0WiQliEDxJRPtvByFjBXw5SwmZj1oyZg+lVDiR7b0/sTC5EZOf4dUDtrzLJj/RxA+fkRIgcDTtyc3t4oI0il+q//ek8QqTzeIicZUQo2xm0fZdfDk4mYSqxdlesin3VxZ5BR/HLsWzAdukPypvM52xrf0mbVczcWoyEfwah4lb/q/1SZnvgccHWhcIY+IWAXxutlmm1Hg/8aW5hMUUK3HF5gsHzR/YcXz54GGmiq2/E9LSiIZya+Lwv4VboCCP2mI9ZMZ23/GzHd4jGykCqdOnE=",
"DefaultConnection": "host=localhost;database=testwithoutusers;schema=testwithoutusers;port=5432;user id=postgres;password=passwordhere;License Key=n7UBDBU7VZ2bJ2bnpFvq0WiQliEDxJRPtvByFjBXw5SwmZj1oyZg+lVDiR7b0/sTC5EZOf4dUDtrzLJj/RxA+fkRIgcDTtyc3t4oI0il+q//ek8QqTzeIicZUQo2xm0fZdfDk4mYSqxdlesin3VxZ5BR/HLsWzAdukPypvM52xrf0mbVczcWoyEfwah4lb/q/1SZnvgccHWhcIY+IWAXxutlmm1Hg/8aW5hMUUK3HF5gsHzR/YcXz54GGmiq2/E9LSiIZya+Lwv4VboCCP2mI9ZMZ23/GzHd4jGykCqdOnE="
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
PostgreSQL database version is 11.
I just upgraded Devart.Data.PostgreSql.EFCore to version 7.21.1985 along with Devart.Data and Devart.Data.PostgreSQL via Nuget Packages (I use NuGet packages in this specific test project).
This is the ConfigureServices method:
Code: Select all
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UsePostgreSql(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddControllersWithViews();
}
PM> update-database
Build started...
Build succeeded.
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
An error occurred using the connection to database 'testwithoutusers' on server 'localhost'.
An error occurred using the connection to database 'testwithoutusers' on server 'localhost'.
Devart.Data.PostgreSql.PgSqlException (0x80004005): Unexpected server response.
at . (Char , Boolean , Boolean )
at . (Char , Boolean , Boolean )
at .(Boolean , Boolean , Char , Boolean )
at .(Boolean , Boolean )
at .(Boolean )
at .( , Boolean , Boolean , Boolean )
at .( , Boolean , Boolean )
at .( , Boolean )
at .()
at .( , Boolean )
at .()
at . ()
at .()
at .(DbConnectionBase )
at . (DbConnectionBase )
at Devart.Common.DbConnectionBase.Open()
at Devart.Data.PostgreSql.PgSqlConnection.Open()
at Devart.Common.Entity.c1.Open()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Unexpected server response.
I also get an error when testing with a ASP.NET Core 3.1 web project:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.SemanticVersionComparer' from assembly 'Microsoft.EntityFrameworkCore, Version=5.0.10.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(IOperationReportHandler reportHandler, IDictionary args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Exception has been thrown by the target of an invocation.
I would like to send a video showing the process I do. Can you tell me how to send it?
I will very much appreciate your support to solve my issue.
Respectfully,
Jorge Maldonado