Reputation: 1
I'm currently trying to work through connecting to a cloud-based database with an Api I've found a lot of similar questions but all the fixes I have found on stack haven't worked for my solution any help would be appreciated [Error that the Api is showing - program.cs ConnectionString ]
ConnectionString in appsettings
:
"ConnectionStrings": {
"MyContext":
"Server=tcp:removed.database.windows.net,1433;Initial Catalog=kawamaraedb;Persist Security Info=False;User ID=Removed;Password='Removed';MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
},
ID and Password are correct
My fix
I figured it out i had to manually type in the connection string from azure and take out alot of the added code string
FROM THIS:
Server=tcp:sql.database.windows.net,1433;Initial Catalog=YOUR DB;Persist Security Info=False;User ID={USER};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
TO THIS
"Data Source=tcp:sql.database.windows.net,1433;Initial Catalog=YOUR DB;User Id={USER};Password={YOUR PASSWORD}"
Upvotes: 0
Views: 149
Reputation: 589
It's not related to Visual Studio 2022. It seems that the connection string is not correct. For instance, InitialCatalog
is not a valid key and should be Initial Catalog
. You may discover more at Connection String Property
Upvotes: 1