0

program.cs ConnectionString Error screenshot

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}"

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

ill look into that now
it is written as initial catalog in the connection string i shouldve been clear i have been able to access the database via visual studio i can scaffold it into a solution but the api always has a heart attack when i try execute anything
also the connection string is the one i received from azure

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.