无法连接到任何指定的MySQL主机 - 通信数据包

时间:2017-12-11 18:35:27

标签: mysql asp.net-mvc azure

我遇到了与MySQL服务器连接的问题。我有一个来自托管A的服务器。当我尝试从localhost连接它总是工作正常。我将我的应用程序(asp.net)发布到azure。然后,它显示错误:

    [MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
   MySql.Data.MySqlClient.NativeDriver.Open() +1155
   MySql.Data.MySqlClient.Driver.Open() +22
   MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +239
   MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() +11
   MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +287
   MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +93
   MySql.Data.MySqlClient.MySqlPool.GetConnection() +65
   MySql.Data.MySqlClient.MySqlConnection.Open() +627
   System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c) +10
   System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +72
   System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +359
   System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2() +55
   System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation) +9
   System.Data.Entity.Core.EntityClient.EntityConnection.Open() +253

我检查了mysqld.err并说:

Got an error reading communication packets

因此,我将max_allowed_pa​​cket从100M更新为500M。它工作了大约10分钟(2到3个请求)。然后它再次显示“无法连接到任何指定的MySQL主机”。

我还注意到我的MySQL日志中有一个警告:

IP address 'azure-ip' could not be resolved: No such host is known.

有人知道会出现什么问题吗?

0 个答案:

没有答案