在 Azure 的管理门户中设置时无法使 EF 连接字符串起作用?
Failing to get EF connection string to work when setup in Azure's management portal?
我正在使用 ASP.NET 部署在 WebApps、EF6、Azure SQL 数据库上的 MVC4
我有两个连接字符串,一个直接连接到数据库,另一个在我使用 Entity Framework 时需要。如果我通过 Azure 设置第一个并将 EF 字符串保留在 web.config 中,一切正常。一旦我尝试将 EF 连接字符串移动到 Azure,它就会中断。
我已尝试关注所有关于如何在 Azure 管理门户中设置 EF 连接字符串的帖子,建议似乎是使用以下内容:
在管理门户中:
姓名:
EFConnectionString
值:
metadata=res://MyModel/model.csdl|res://MyModel/model.ssdl|res://MyModel/model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=tcp:myserver.database.windows.net,1234;Initial Catalog=mydatabase;User ID=Admin@myserver.database.windows.net;Password=12345678"
SQL 数据库:
Custom
注:
" is replaced by " in the Azure string.
在Web.config我还需要以下内容:
<add name="EFConnectionString" connectionString="" providerName="System.Data.EntityClient"/>
出于安全原因,我更改了连接字符串中的某些细节,但真正的字符串在 Web.config 中工作正常。
然而,当我尝试上述操作时,我得到:
The page cannot be displayed because an internal server error has occurred.
进一步记录错误消息:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
感谢任何帮助。我正在尝试这样做以增强用于访问 Azure 上的数据库的存储密码的安全性,据我所知,通过门户设置它们会对其进行加密。
谢谢。
首先检查您的部署。我 运行 遇到了类似的问题,经过几个小时的努力,我发现我在部署时并没有实际发送连接字符串,而是回退到门户配置中的任何内容…… we.config 正在发送过来,但没有连接字符串...在我在门户上正确设置后,一切恢复正常...
我正在使用 ASP.NET 部署在 WebApps、EF6、Azure SQL 数据库上的 MVC4
我有两个连接字符串,一个直接连接到数据库,另一个在我使用 Entity Framework 时需要。如果我通过 Azure 设置第一个并将 EF 字符串保留在 web.config 中,一切正常。一旦我尝试将 EF 连接字符串移动到 Azure,它就会中断。
我已尝试关注所有关于如何在 Azure 管理门户中设置 EF 连接字符串的帖子,建议似乎是使用以下内容:
在管理门户中:
姓名:
EFConnectionString
值:
metadata=res://MyModel/model.csdl|res://MyModel/model.ssdl|res://MyModel/model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=tcp:myserver.database.windows.net,1234;Initial Catalog=mydatabase;User ID=Admin@myserver.database.windows.net;Password=12345678"
SQL 数据库:
Custom
注:
" is replaced by " in the Azure string.
在Web.config我还需要以下内容:
<add name="EFConnectionString" connectionString="" providerName="System.Data.EntityClient"/>
出于安全原因,我更改了连接字符串中的某些细节,但真正的字符串在 Web.config 中工作正常。
然而,当我尝试上述操作时,我得到:
The page cannot be displayed because an internal server error has occurred.
进一步记录错误消息:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
感谢任何帮助。我正在尝试这样做以增强用于访问 Azure 上的数据库的存储密码的安全性,据我所知,通过门户设置它们会对其进行加密。
谢谢。
首先检查您的部署。我 运行 遇到了类似的问题,经过几个小时的努力,我发现我在部署时并没有实际发送连接字符串,而是回退到门户配置中的任何内容…… we.config 正在发送过来,但没有连接字符串...在我在门户上正确设置后,一切恢复正常...