Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF、实体框架和N层解决方案_Wcf_Entity Framework - Fatal编程技术网

WCF、实体框架和N层解决方案

WCF、实体框架和N层解决方案,wcf,entity-framework,Wcf,Entity Framework,我已经在3层解决方案中使用实体框架实现了WCF服务。我让它工作了,但让我困惑的是,为什么我必须将连接字符串(在配置文件C1中指定,实体框架使用它从数据库检索架构信息)复制到配置文件C2used WCF service中?名义上,如果我不复制连接字符串,那么我会得到: FaultException: The specified named connection is either not found in the confiuration, not intended to be used wit

我已经在3层解决方案中使用实体框架实现了WCF服务。我让它工作了,但让我困惑的是,为什么我必须将连接字符串(在配置文件C1中指定,实体框架使用它从数据库检索架构信息)复制到配置文件C2used WCF service中?名义上,如果我不复制连接字符串,那么我会得到:

FaultException: The specified named connection is either not found in the confiuration, 
not intended to be used with the EntityClient provider, or not valid.
因此,实体框架似乎在设计时使用了C1的连接字符串,而在运行时使用了C2中指定的连接字符串来连接数据库?为什么?


谢谢

除非您另有指定,否则连接字符串始终来自执行程序集的配置文件。原因很明显:引用同一数据DLL的两个不同的可执行文件可能希望使用不同的物理数据库

在设计时,没有正在执行的程序集。因此,将使用包含EDMX的项目的配置文件