I've tried to publish My Asp Boilerplate project to Ubuntu using Docker , but I got a problem. Unable to connect to any of the specified MySQL hosts.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
**crit:** Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
Application startup exception
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
at MySqlConnector.Core.ServerSession.<ConnectAsync>d__56.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 239
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MySql.Data.MySqlClient.MySqlConnection.<CreateSessionAsync>d__77.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 365
Here's my connection,
{
"ConnectionStrings": {
"Default": "Server=128.199.250.219; Database=CityInfoDb; User Id=****; Password=******;"
},
"App": {
"WebSiteRootAddress": "http://localhost:9903/"
}
}
Maybe my dockerfile incorrect , Please help me I'm frustated.
Your connection string seems to be incorrect, please find below the example.
{
"ConnectionStrings": {
"Default": "server=127.0.0.1;uid=root;pwd=1234;database=mysqldemodb"
},
...
}
You can refer EF Core MySql Integration.
User contributions licensed under CC BY-SA 3.0