我尝试使用Docker向Ubuntu发布My Asp Boilerplate项目,但是我遇到了问题。无法连接到任何指定的MySQL主机。
--- 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
这是我的 连接,
{
"ConnectionStrings": {
"Default": "Server=128.199.250.219; Database=CityInfoDb; User Id=****; Password=******;"
},
"App": {
"WebSiteRootAddress": "http://localhost:9903/"
}
}
也许我的dockerfile不正确,请帮帮我,我很沮丧。
答案 0 :(得分:0)
您的连接字符串似乎不正确,请在示例下方找到。
{
"ConnectionStrings": {
"Default": "server=127.0.0.1;uid=root;pwd=1234;database=mysqldemodb"
},
...
}