i am unable to do "update-database" in EFCore using MVC
this is the info it gives for not being able to do it
"Microsoft.Data.SqlClient.SqlException (0x80131904): 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: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
---> System.ComponentModel.Win32Exception (2): The system cannot find the file specified."
does anyone have any ideas? i have been following a tutorial and he hasnt done anything that i havent so i dont know why my "update-database" wont work, i have a sql server set up(image 1)
19 Replies
Have you connected to sql via ssms or azure data studio?
ssms
this is the error ive got to now:"Microsoft.Data.SqlClient.SqlException (0x80131904): 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)
---> System.ComponentModel.Win32Exception (53): The network path was not found."
my connection string :" "ConnectionStrings": {
"DefaultConnection": "Server=CDRIVETEST;Database=master;Trusted_Connection=True;MultipleActiveResultSets=true"
}, "
any help would be much appreciated
Your servername should include what you hid in the screenshot
changed it now get this one: "A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)" sorry for all the questions i really appreciate everyones patience even when i ask stupid questions haha
how can i trust it? is there something i should change?
I think you can just set trusted_connection to false here
Also there are no stupid questions
Except the ones that remain unasked and unanswered
(Now that does not mean that you should ask every question, it is also important to try and search by yourself sometimes.)
just tried, still no luck. just says the same error
thats the current connection code
SQL Authority with Pinal Dave
SQL SERVER - Fix - Error - The certificate chain was issued by an a...
ASP.NET Core applications can sometimes result in the error "The certificate chain was issued by an authority that is not trusted."
Sorry didn't mean to abandon you, getting ready for a run
should i try replace "Trusted_Connection=False" with "Integrated Security=True;"
No
Look at the first thing
Talking about TrustServerCertificate
Also in both case it would not replace things, just a new param
And you can revert to Trusted_Connection=True I guess
IT WORKED
OMG
OMGGGG
THANK YOU BOTH SO MUCH
I THINK I WAS TRYING TO FIND A WAY TO MAKE THAT WORK FOR LIKE 5 HOURS STRAIGHT ACROSS ONE DAY
THIS IS THE HAPPIEST MOMENT IN MY LIFE
no problem! thank you for your help with this problem and all my others today haha
tysm. literally a life saver. i actually dont know what i wouldve done if i couldnt get this to work!
i wouldve had to find another sql server thing and it wouldve made everything so complex
All of that is why I don't like SQL Server. Always a pain to get it working
For beginners MySQL /MariaDB WAY easier
And when you need a better system, PostgreSQL is as good, if not better than SQL server depending on use cases and easier to connect to imo
i will 100% look into that then haha