小编Byr*_*dif的帖子

部署到Azure - 无法连接到数据库

我最近订阅了Azure免费试用版,我目前正在尝试发布我的网站.

但是,当我发布我的网站时,我遇到了以下错误:

[NullReferenceException: Object reference not set to an instance of an object.]
MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +56
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +276
   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +27
   System.Data.Entity.Infrastructure.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k) +32
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +251
   System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +56
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +43
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +123
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +610
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +38
Run Code Online (Sandbox Code Playgroud)

当我使用连接字符串本地运行到我的远程数据库时,它工作正常,但是一旦我发布它就不起作用.

我的连接字符串如下所示:

<add name="DefaultConnection" connectionString="user id=****;password=****;persistsecurityinfo=False;server=**** ;database=iprospect_tools" providerName="MySql.Data.MySqlClient" />
<add name="ToolsEntities" connectionString="metadata=res://*/ToolsModel.csdl|res://*/ToolsModel.ssdl|res://*/ToolsModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;user id=****;password=****;persistsecurityinfo=False;server=****;database=tools&quot;" providerName="System.Data.EntityClient" />
Run Code Online (Sandbox Code Playgroud)

当我远程调试我的应用程序时,这是错误评估:

在此输入图像描述

知道可能导致此错误的原因是什么?

c# mysql entity-framework azure azure-web-sites

2
推荐指数
1
解决办法
302
查看次数

标签 统计

azure ×1

azure-web-sites ×1

c# ×1

entity-framework ×1

mysql ×1