gpt4 book ai didi

c# - 不支持关键字 : 'data source' . - Azure

转载 作者:行者123 更新时间:2023-12-05 08:09:07 24 4
gpt4 key购买 nike

我在 MVC Web 应用程序中使用 Entity Framework 。我的数据库位于 azure 中,我正在将我的 Web 应用程序部署到 azure。但是当我部署应用程序时,我收到以下错误。即使我连接到同一个数据库,我在调试时也没有收到此错误。

错误

Keyword not supported: 'data source'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported: 'data source'.

连接字符串

<add name="SoccerEntities" 
connectionString="metadata=res://*/Models.MyModel.csdl
|res://*/Models.MyModel.ssdl
|res://*/Models.MyModel.msl;
provider=System.Data.SqlClient;
provider connection string='server=tcp:<servername>,1433;
initial catalog=MyDB;
persist security info=True;
user id=user;
password=pwd;
MultipleActiveResultSets=True;
App=EntityFramework'"
providerName="System.Data.EntityClient" />

最佳答案

找到答案了。显然,Azure IIS Web App 中设置了一些开箱即用的默认连接字符串。我不确定为什么我的 Web.config 没有覆盖这些设置,但事实并非如此。我必须在管理面板中设置默认的连接字符串。

在 Azure 管理面板中:

Select App -> Application Settings -> Enter new Connection String -> Save

关于c# - 不支持关键字 : 'data source' . - Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41225885/

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