Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to connect to an existing postgreSQL database in a new Blazor Server Web App?

$
0
0

I try to scaffold DbContext using this line in package manager console:

Scaffold-DbContext "host=xx.xx.xx.xxx port=xxxx dbname=postgres user=xxxx password=xxxx sslmode=prefer connect_timeout=10 sslcert=<STORAGE_DIR>/.postgresql/postgresql.crt sslkey=<STORAGE_DIR>/.postgresql/postgresql.key" Npgsql.EntityFrameworkCore.PostgreSQL -OutputDir Models

and i get this exeption:

System.Net.Sockets.SocketException (0x00002AF9) No such host known

i have installed the following packages first:

Microsoft.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.ToolsNpgsql.EntityFrameworkCore.PostgreSQL

Am i supposed to setup the connection string in appsettings.json first and add dbcontext to builder.Services before scaffolding?


Viewing all articles
Browse latest Browse all 4839

Trending Articles