我已将.net应用程序部署为docker容器,试图连接到放置在主机中的mysql数据库。 这是我在运行容器时遇到的错误
MySql.Data.MySqlClient.MySqlException (0x80004005): Host 'host.docker.internal' is not allowed to connect to this MySQL
server
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at NetworkBridge.Program.MySql(String server, String database) in C:\src\Program.cs:line 91
All done. Press any key to finish...
我在Google上尝试了许多解决方案,但对我来说却无济于事!