The ASP.NET Core MVC always fails with the Scaffolding command.

Asked 2 years ago, Updated 2 years ago, 128 views

I am a beginner at ASP.NET Core MVC.As the title says, I can't do the scuffolding.
Run the following command:

dotnet ef dbcontext scaffold"Server=.; Database=testdb; Trusted_Connection=True;"Microsoft.EntityFrameworkCore.SqlServer-o Models

The following error occurs:

A network-related or instance-specific error occurred while installing a connection to SQL Server.The server was not found or was not accessible.Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (Provided-Processor: 40)

SQL Server itself is built, and you can view data tables from Visual Studio or from SQL Server Object Explorer.The data table name should also be "testdb" correct.Please let me know if anyone knows the cause of the error.

c# sql-server asp.net-core

2022-09-30 21:37

2 Answers

Compare the value of the connection string in the Properties window of the connection shown in the lower right corner when Visual Studio is connected.
You will notice something.

Visual Studio Connection String Location


2022-09-30 21:37

In the Server specification, specify the hostname (address) followed by the instance name.
Example) localhost\SQLEXPRESS

The instance name can be found from the service name in the Service Management Tool (windows).
Example) "SQL Server (SQLEXPRESS)"


2022-09-30 21:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.