【发布时间】:2023-04-10 16:11:01
【问题描述】:
这是我用于本地调试的连接字符串:
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=SFP;
initial catalog=POLLINATORS;
integrated security=True;
MultipleActiveResultSets=True;
App=EntityFramework"
部分堆栈跟踪:
在 System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions 的 System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, String& keyname, String& keyvalue)。 ParseInternal(IDictionary2 parsetable, String connectionString, IList1 validKeywords) 在 System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions..ctor(String connectionString, IList1 validKeywords) at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.Entity.Core.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.Initialize() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() 在 System.Data.Entity.Internal.Linq。 InternalSet1.get_InternalContext() at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider()
感谢您的帮助! ~苏珊~
【问题讨论】:
-
该错误表明,在连接字符串的第 100 个字符处,连接字符串不再有效。您是否将其保存在 web.config 中的多行中?你不能那样做。
标签: entity-framework connection-string