gpt4 book ai didi

azure-sql-database - Azure 中的 EF6 连接字符串

转载 作者:行者123 更新时间:2023-12-04 07:53:41 24 4
gpt4 key购买 nike

我们在 Azure 上有一个网站和一个 sql 服务器。我们已在 Azure 门户中包含 Entity Framework 连接字符串,但出现以下错误:
应用程序配置文件中的连接字符串“MyEntities”不包含所需的 providerName 属性。"

查看连接字符串,它显然具有提供程序:

metadata=res:///MyEntities.csdl|res:///MyEntities.ssdl|res://*/MyEntities.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:myserver. database.windows.net,1433;initial catalog=mydatabase;user id=user@myserver;password=PASSWRD;MultipleActiveResultSets=True;App=EntityFramework""providerName="System.Data.EntityClient"

那么它要求什么呢?我们还替换了 "使用普通引号,但我们仍然收到此错误。

在我们的开发中使用相同的连接字符串并连接到 azure sql server 时一切正常,但不知何故,我们放置在门户中的连接字符串替换了 web.config 中的连接字符串有问题。

任何帮助,将不胜感激

最佳答案

门户没有能力接受 providerName 属性。因此,您需要在 web.config 中保留连接字符串,它指定名称和 providerName,但只需为连接字符串输入一个虚拟值。现在将该连接字符串值放入门户连接字符串中。当它运行时,它会从 web.config 中获取 providerName,然后用你在 Azure 门户应用程序设置 [连接字符串] 中放置的连接字符串值覆盖 web.config 中的虚拟连接字符串。见 SQL Azure EF Database First Connection String in Azure Management Portal

关于azure-sql-database - Azure 中的 EF6 连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35120725/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com