Following exception is being thrown when .net core 2.1 API application's docker image is executed(run) on Linux machine
I am using Pomelo.EntityFrameworkCore.MySql to use MySQL Database
When I build and run the api image on windows machine it is running fine, but when I tried to run the same image on linux, following exception is being thrown.
It is the same case when I build and run the image on linux machine.
Not sure what is going wrong.
Microsoft.EntityFrameworkCore.Database.Connection[20004. An error occurred using the connection to database '' on server ''. MySql.Data.MySqlClient.MySqlException (0x80004005): Connect Timeout expired. --- System.ObjectDisposedException: Safe handle has been closed at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success) at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success) Interop.Sys.TryChangeSocketEventRegistration(IntPtr port, SafeHandle socket, SocketEvents currentEvents, SocketEvents newEvents, IntPtr data)
Looking forward for expert help and highly appreciated.
The container/server running MySQL Server is not accessible from your Docker container running your application. As a result, your application is timing out (“Connect Timeout expired”) when attempting to open a database connection.
Make sure your network setup allows your web server to contact the DB server on port 3306.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With