EF之数据库连接问题The specified named connection is either not found in the configuration, not intended to be used with the Ent

Entity Framework项目自动生成的edmx文件的连接字符串的问题

1.首先修改<add name="NorthWindEntities"        connectionString="metadata=res://*/NorthWind.csdl|res://*/NorthWind.ssdl|res://*/NorthWind.msl;provider=System.Data.SqlClient;provider connection string=&quot;    fData Source=127.0.0.1;Initial Catalog=NorthWind;Persist Security Info=True;User ID=sa;Password=123456;MultipleActiveResultSets=True&quot;"  providerName="System.Data.EntityClient" />

2.若是出现以下异常则说明执行程序所在的项目没有引用到该连接字符串

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient Provider, not valid.

一般是连接字符串所在的App.Config的问题,他必须出现在执行程序所在的那个Web.Config 或者是 App.Config

参考:MSDN

原文地址:https://www.cnblogs.com/senion/p/2020379.html