【发布时间】:2015-10-02 04:42:13
【问题描述】:
我在 windows 8.1 pro pc 中使用 EF6 在 Visual Studio 2013 Update 4 中开发了一个 Web api 项目,这是我由 EF 生成的连接字符串
<connectionStrings>
<add name="bcsmdbEntities" connectionString="metadata=res://*/BCSMModel.csdl|res://*/BCSMModel.ssdl|res://*/BCSMModel.msl;
provider=System.Data.SqlClient;provider connection string="data source=j01qw1lha2.database.windows.net;
initial catalog=bcsmdb;persist security info=True;user id=xxxxxx;password=xxxxxxxx;
MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
当我执行 GET 请求时,它在我的本地计算机上工作正常,但在将其部署为 azure 作为 Web 应用程序后,它返回 500 内部服务器错误。错误详情是这样的
{
"Message": "An error has occurred.",
"ExceptionMessage": "The underlying provider failed on Open.",
"ExceptionType": "System.Data.Entity.Core.EntityException",
"StackTrace": " at System.Data.Entity.Core.EntityClient.EntityConnection.Open()\r\n at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)\r\n at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()\r\n
谁能帮我找出问题所在?提前致谢
【问题讨论】:
-
检查数据库服务器地址是否正确,是否可达
-
以前它工作正常,我已经多次使用过这样的所有东西,但是当我用新数据库更改实体模型时,它的行为就像这样,有关信息,我是 azure 帐户的共同管理员,其中数据库是并部署了网络应用程序
-
尝试指向一个新的数据库并检查。
-
是的,我尝试过使用新数据库和新区域,但结果相同