【问题标题】:Connect MySQL DB with entity framework error使用实体框架错误连接 MySQL DB
【发布时间】:2016-11-17 02:43:12
【问题描述】:

我使用实体框架和 MySQL 开发了一个 ASP MVC 5 应用程序。 在本地我运行成功。但是当我转移到托管并运行它时会抛出异常。

System.Data.Entity.Core.ProviderIncompatibleException:从数据库获取提供程序信息时出错。这可能是由 Entity Framework 使用不正确的连接字符串引起的。检查内部异常以获取详细信息并确保连接字符串正确。 ---> System.Data.Entity.Core.ProviderIncompatibleException:提供者未返回 ProviderManifestToken 字符串。 ---> MySql.Data.MySqlClient.MySqlException:无法连接到任何指定的 MySQL 主机。在 MySql.Data.MySqlClient.NativeDriver.Open() 在 MySql.Data.MySqlClient.Driver.Open() 在 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder 设置) 在 MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() 在 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() 在 MySql.Data.MySqlClient.MySqlPool.GetConnection() 在 MySql.Data.MySqlClient.MySqlConnection.Open() 在 MySql .Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection) at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) --- 内部异常堆栈跟踪结束--- System.Data.Entity.Core .Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) --- 内部异常堆栈跟踪结束 --- 在 System.Da ta.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.c__DisplayClass1.b__0(Tuple`3 k) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest&providerManifest) 在 System.Data.Entity .DbModelBuilder.Build(DbConnection providerConnection) 在 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) 在 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput 输入) 在 System.Data.Entity.Internal .LazyInternalContext.InitializeContext() 在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) 在 Sys tem.Data.Entity.Internal.Linq.InternalSet`1.Initialize() 在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() 在 System.Data.Entity.Infrastructure.DbQuery`1.System。 Linq.IQueryable.get_Provider() at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) at Mdt.Business.CommonRepository.LoginAdmin(String username, String passwod) at Mdt.BackendWeb.Controllers .LoginController.Index(LoginAdminModel model, String returnUrl)

但我上传到另一个主机,它运行正常。

我不知道为什么。

请帮帮我。

【问题讨论】:

    标签: c# mysql asp.net-mvc entity-framework


    【解决方案1】:

    在与我的托管服务提供商交谈后。他们说他们被阻止了来自外部互联网(来自越南外地,我在越南的托管服务提供商)的请求,但我的数据库托管在美国服务器上,因为他们的服务器一直在攻击。 :((

    【讨论】:

      猜你喜欢
      • 2015-04-10
      • 2021-11-01
      • 2017-08-14
      • 1970-01-01
      • 1970-01-01
      • 2019-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多