#entity-framework #connection-string
#entity-framework #строка подключения
Вопрос:
Вот моя строка подключения для локальной отладки:
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection string=amp;quot;
data source=SFP;
initial catalog=POLLINATORS;
integrated security=True;
MultipleActiveResultSets=True;
App=EntityFramework"
Частичная трассировка стека:
в System.Data.Entity.Core.EntityClient.Внутренний.DbConnectionOptions.GetKeyValuePair(строка ConnectionString, текущее положение Int32, буфер StringBuilder, строка и ключевое имя, строка и ключевое значение) в System.Data.Entity.Core.EntityClient.Внутренний.DbConnectionOptions.ParseInternal (идентификатор 2 parsetable, String connectionString, IList
1 validKeywords) в System.Data.Entity.Core.EntityClient.Внутренний.DbConnectionOptions..ctor(строка ConnectionString, IList 1 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.InternalSet
1.Инициализируйте() в System.Data.Entity.Internal.Linq.InternalSet 1.get_InternalContext() at System.Data.Entity.Infrastructure.DbQuery
1.System.Linq.IQueryable.get_Provider()
спасибо за вашу помощь! ~ сьюзан~
Комментарии:
1. Ошибка говорит о том, что в символе 100 вашей строки подключения строка подключения больше не действительна. Вы сохраняете ее в нескольких строках, подобных этой, в вашем web.config? Вы не можете этого сделать.
Ответ №1:
В строке подключения поставщика отсутствуют закрывающие кавычки:
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection string=amp;quot;
data source=SFP;
initial catalog=POLLINATORS;
integrated security=True;
MultipleActiveResultSets=True;
App=EntityFrameworkamp;quot;"
Комментарии:
1. Спасибо, это сработало отлично. Однако это выявило другую проблему. Я открою другой запрос. Действительно ценю вашу помощь!