Search code examples
visual-studioazureazure-web-app-servicevisual-studio-2019remote-debugging

The underlying provider failed on Open. Remote Debbuging with Azure to VS2019


I am remotely debugging my application with azure and VS2019 and it works fine until I have to connect to the database. Then I get the following error. "The underlying provider failed on Open."

On the other hand, if I debug locally everything works correctly.

Do you have to activate any permission in Azure or in the project config so that the database can be accessed remotely?

Right after the connection string I have put the following.

_context.Database.Connection.Open ();

So it returns the following error to me: "Unable to connect to any of the specified MySQL hosts".

All this locally does not happen to me. Only when trying to debug remotely.


Solution

  • According to your description, we can ensure that the remote debug function of vs2019 is normal. An error is reported in this _context.Database.Connection.Open (); code. Obviously, the program cannot connect to the mysql database server.


    Troubleshooting:

    First make sure that your mysql database server can be accessed using tools (such as Mysql Workbench).

    1. Using tools to ensure that the database is accessible is to ensure that the firewall of your database server is open (mysql in azure or other server).

    2. Check the connectionstring of mysql in the released program. According to your error message, it is likely that the connection string is used incorrectly.