Error trying to add Authentication

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
GATOWARE
Posts: 5
Joined: Mon 27 Sep 2021 18:10

Error trying to add Authentication

Post by GATOWARE » Mon 27 Sep 2021 18:35

Hi,

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
So, I use NuGet instead of the command below to make sure version 7.20.1905.0 is installed:
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": "*"
}
I have double-checked the connection string content (database name, schema name, port, user id, password)
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();
        }
This is the error I get:

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

Shalex
Site Admin
Posts: 9424
Joined: Thu 14 Aug 2008 12:44

Re: Error trying to add Authentication

Post by Shalex » Thu 30 Sep 2021 08:55

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

GATOWARE
Posts: 5
Joined: Mon 27 Sep 2021 18:10

Re: Error trying to add Authentication

Post by GATOWARE » Thu 07 Oct 2021 13:49

Hi,

Is there an estimated date for the solution of this issue?

Respectfully,
Jorge Maldonado

Shalex
Site Admin
Posts: 9424
Joined: Thu 14 Aug 2008 12:44

Re: Error trying to add Authentication

Post by Shalex » Fri 08 Oct 2021 15:59

The investigation is in progress. We cannot provide any timeframe at the moment.

GATOWARE
Posts: 5
Joined: Mon 27 Sep 2021 18:10

Re: Error trying to add Authentication

Post by GATOWARE » Mon 18 Oct 2021 18:55

Will you let me know about the fix or will you just include it in a new version?

Regards,
Jorge Maldonado

Shalex
Site Admin
Posts: 9424
Joined: Thu 14 Aug 2008 12:44

Re: Error trying to add Authentication

Post by Shalex » Fri 22 Oct 2021 16:22

We will post a notification about the fix in this thread. We are working on the issue.

GATOWARE
Posts: 5
Joined: Mon 27 Sep 2021 18:10

Re: Error trying to add Authentication

Post by GATOWARE » Wed 10 Nov 2021 15:43

It´s been some time since I reported this issue, about one month and a half. Are there any news about it? Is this a complex situation?

Respectfully,
Jorge Maldonado

Shalex
Site Admin
Posts: 9424
Joined: Thu 14 Aug 2008 12:44

Re: Error trying to add Authentication

Post by Shalex » Mon 15 Nov 2021 08:56

We are looking for a solution. As soon as the bug is fixed, we will contact you.

GATOWARE
Posts: 5
Joined: Mon 27 Sep 2021 18:10

Re: Error trying to add Authentication

Post by GATOWARE » Tue 16 Nov 2021 15:44

Thanks for the update.

Regards,
Jorge Maldonado

Post Reply