How do I fix this error? MySql.Data.MySqlClient.MySqlException: 'Unable to connect to any of the specified MySQL hosts.'

Junior 0 Reputation points
2023-05-16T03:13:51.58+00:00

I made an asp.net api that is currently hosted on azure webapp. I am having trouble with the post put and delete request so I tried running the code I have locally, but I keep getting this error "MySql.Data.MySqlClient.MySqlException: 'Unable to connect to any of the specified MySQL hosts.'" Initially, it was working before, but now that I want to run the app locally and make crud operations to a mysql database also hosted on azure mysql server, I get that error. Now that I think about it, it probably is a server error. I say this because the only calls that work online are the get calls but when I try perform post, put or delete, it does not work. where as when I try to work on it locally, none of my endpoints work

Azure Database for MySQL
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.