While there is no error in my code, when I try to migrate I see this error in package manager console:
A network-related or instance-specific error occurred while establishing 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
I assume the web serer does not have a database server running. Only you know the answer to this question.
Also this is a duplicate thread which is against forum rules. It wastes forum members time when they provide solutions that have have been discussed on the other thread.
Member
21 Points
246 Posts
error: 40 -Could not open a connection to SQL Server
Apr 07, 2020 08:52 PM|SaeedP|LINK
Hello
While there is no error in my code, when I try to migrate I see this error in package manager console:
A network-related or instance-specific error occurred while establishing 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
Where is wrong?
thanx
All-Star
53021 Points
23607 Posts
Re: error: 40 -Could not open a connection to SQL Server
Apr 07, 2020 09:15 PM|mgebhard|LINK
Invalid connection string.
Did you forget to update the connection string from your dev SQL server running on your development PC to your actual SQL server?
Member
21 Points
246 Posts
Re: error: 40 -Could not open a connection to SQL Server
Apr 08, 2020 12:49 AM|SaeedP|LINK
I'm trying to migrate my mode in ASP.net Blazor (serverside).
I'm a beginner in Blazor. But familiar with ASP.net core MVC. Where should to update the connection string?
Can you please explain a bit more.
Member
70 Points
79 Posts
Re: error: 40 -Could not open a connection to SQL Server
Apr 08, 2020 05:58 AM|ifour.parth@gmail.com|LINK
in blazor you have to add connectionstrings in appsetting file
"ConnectionStrings" : {
"DefaultConnection" : "Server=YourServerName;Database=YourDatabaseName;user id=YourUserId;password=YourPassword;Trusted_Connection=true"
},
http://www.ifourtechnolab.com/blockchain-technology
Member
21 Points
246 Posts
Re: error: 40 -Could not open a connection to SQL Server
Apr 08, 2020 07:14 PM|SaeedP|LINK
Do I need to install the SQL server manually or it's like asp MVC and make the table automatically?
Here comes my appseting:
DbContext:
add Db in startup:
Is something wrong?
All-Star
53021 Points
23607 Posts
Re: error: 40 -Could not open a connection to SQL Server
Apr 08, 2020 08:30 PM|mgebhard|LINK
The connection string is looking for a database server on the web server.
I assume the web serer does not have a database server running. Only you know the answer to this question.
Also this is a duplicate thread which is against forum rules. It wastes forum members time when they provide solutions that have have been discussed on the other thread.