Default security postgresql error

I am creating the Blazor tutorial CRM app on an Ubuntu 20.04 workstation using postgresql, and I get this error when running the app for the first time:

Seems some of the identity database structures are not really sql version agnostic. Can I modify this code myself?

Also, is there a way not to use the duende identity server on linux?

Thanks!

Error message:

dotnet: fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TABLE "Keys" (
"Id" varchar(450) NOT NULL,
"Version" int NOT NULL,
"Created" date NOT NULL,
"Use" nvarchar(450) NULL,
"Algorithm" varchar(100) NOT NULL,
"IsX509Certificate" bit NOT NULL,
"DataProtected" bit NOT NULL,
"Data" text NOT NULL,
CONSTRAINT "PK_Keys" PRIMARY KEY ("Id")
);

dotnet: crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
Npgsql.PostgresException (0x80004005): 42704: type "nvarchar" does not exist

  POSITION: 122
     at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlDataReader.NextResult()
     at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery()

dotnet: at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable1 migrationCommands, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
at CrmCls.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationIdentityDbContext identityDbContext) in /home/fstonge/repos/Radzen/CrmCls/server/Startup.cs:line 157
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Watch.BrowserRefresh.HostingStartup.<>c__DisplayClass1_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Exception data:
Severity: ERROR
SqlState: 42704
MessageText: type "nvarchar" does not exist
Position: 122
File: parse_type.c
Line: 271
Routine: typenameType

dotnet: Unhandled exception.
dotnet: Npgsql.PostgresException (0x80004005): 42704: type "nvarchar" does not exist

POSITION: 122
at Npgsql.Internal.NpgsqlConnector.g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable1 migrationCommands, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
at CrmCls.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationIdentityDbContext identityDbContext) in /home/fstonge/repos/Radzen/CrmCls/server/Startup.cs:line 157
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.b__1(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Watch.BrowserRefresh.HostingStartup.<>c__DisplayClass1_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at CrmCls.Program.Main(String[] args) in /home/fstonge/repos/Radzen/CrmCls/server/Program.cs:line 18
Exception data:
Severity: ERROR
SqlState: 42704
MessageText: type "nvarchar" does not exist
Position: 122
File: parse_type.c
Line: 271
Routine: typenameType

You can change that to varchar, we will update our templates.

Not sure what’s the problem. The entire .NET works normally on Linux, same applies for used libraries.

Hi enchev,

I understand this, but I did not know where was the script that needed to be corrected.

As far as I could read, the duende identity server is fully open source, but requires a license fee if used in a company larger than 1M a year.

Also, as far as I saw, this is not the case for the original identity server 4 used in when generating on windows:

Am I misguided?

Thanks

Hi enchev,

It is actually worst than I thought:

If I read this correctly, it means that if I want to create a new Radzen Blazor application, I will eventually have to purchase a license from duende, or keep running IdentityServer4 without security updates. Am I reading this correctly?

Hi @fstonge,

Radzen generates Blazor WebAssembly projects inspired by the default Microsoft Blazor WebAssembly templates (which happen to use IdentityServer). Radzen Blazor Server applications rely on ASP.NET Core Identity which does not use IdentityServer.

1 Like

Hi korchev,

Thank you for the response. I cannot use the Blazor server-side template because of networking limitations we have. Do you think it is worth it for us to try to modify the server component our the Radzen Blazor wasm generated application to use ASP.Net Core Identity instead of IdentityServer4? We already use ComponentSpace SAML ASP.Net core for SSO in our Angular project, I am wondering if I could do the same in the Blazor wasm project. Can this be done while keeping the Radzen login component, or would we have to create our own custom login component?
Thank you for your help and patience.

If you don't want to use IdentityServer - it probably is worth it. We haven't done it for a Blazor WebAssembly application though and don't have any experience with such a conversion.

The default login implementation relies on the generated AccountController.cs file. The login should work just fine if you keep the AccountController method signatures and returned result the same.

Hi korchev,

We will do the shift, and I will document it for community.

With this, I am now presenting Radzen to my client. If all goes well, the Canadian development team will adopt it, this would mean at least 2 seats.

The real prize will be the numerous US teams. If we can do a good job with it, this will mean a lot more seats.

I will keep you posted.

Thanks

1 Like