不支持关键字:“服务器”。旧的Asp.Net系统

问题描述 投票:0回答:1

我有一个使用 .Net Framework 4.0、ASP.Net、EntityFramework、C# 和 SQL Server 2014 的旧系统。

我在尝试运行系统时不断收到错误,它以前可以工作! -

“‘/’应用程序中的服务器错误。

不支持关键字:“服务器”。 描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。”

Stack Trace:


[ArgumentException: Keyword not supported: 'server'.]
   System.Data.EntityClient.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Hashtable synonyms) +10219986
   System.Data.EntityClient.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms) +114
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +400
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +56
   Providers.ssirsMembershipProvider.GetFailedPasswordWindowForUser(String username) +111
   _Default.Login2_LoginError(Object sender, EventArgs e) +119
   System.Web.UI.WebControls.Login.OnLoginError(EventArgs e) +139
   System.Web.UI.WebControls.Login.AttemptLogin() +11591419
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +111
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1890

这与我的 web.config 中的连接字符串有关 -

  <connectionStrings>
    <add connectionString="server=svrDatabases;database=MyDatabase;uid=myuser;pwd=*****" name="myConnectionString" providerName="System.Data.SQLClient" />
    <add connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=svrDatabases;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=myuser;Password=*****;MultipleActiveResultSets=True&quot;" name="myEntities" providerName="System.Data.EntityClient" />
  </connectionStrings>

我尝试将提供程序名称更改为 EntityClient,但没有什么区别。

用头撞墙。

有人可以帮忙吗!

谢谢

c# asp.net entity-framework connection-string
1个回答
0
投票

SQL Server 连接条目应如下所示(使用 SQL Server 身份验证时):

<add name="CONNECTION_NAME" connectionString="data source=SERVER_NAME;Initial Catalog=DATABASE_NAME;User Id=USER_NAME;Password=PASSWORD" providerName="System.Data.SqlClient" />

有关更多选项,请检查 https://www.connectionstrings.com/sql-server/

© www.soinside.com 2019 - 2024. All rights reserved.