I have built a web API using dotnet and this is my first time using Azure (or any other cloud platform) to host a web application. I use EntityFramework and MySQL database to build my project.
I use DbConnectionString = "Server=localhost;Database=hms;Uid='{root-user}';Pwd={pw};"
as the connection string for my SQL database now I want to know how I can connect it with the Azure SQL database I created. I added my IP address in firewall access to the Azure server and tried changing the connection string to DbConnectionString = "Server=server.database.windows.net:1433;Database=hms;Uid='{root -user}';Pwd= {pw};"
But it gave the error An exception was thrown, probably due to a transient failure. When I try to update the database after adding the migration, consider enabling transient error resilience by adding "EnableRetryOnFailure()" to the "UseMySql" call.
.
I'd like to know what I'm doing wrong or what else I need to do to get it running. Tia.
3. Create a console application using C#.
Add package Microsoft.Data.SqlClient to the project.
Added the following code in the Program.cs file,
6. Using the above code, I connect to Azure SQL and retrieve data from the database.
Reference link:
https://learn.microsoft.com/en-us/visualstudio/azure/azure-sql-database-add-connected-service?view=vs-2022