简体   繁体   中英

WCF with EF6 - No connection string named 'Entities' could be found in the application config file , [I SET IT]

I have a WCF Application with this layers

在此输入图像描述

I Set ConnectionString in to layers

I. in DataAccess that have edmx model

在此输入图像描述

II. in Console Test Application that I use proxy class of WCF for intraction with it

在此输入图像描述

but when I run Console Test shows this error !!!

在此输入图像描述

seems DataAccess layer can not find existing connection string but WHY ?

What is Wrong ?!?!?!

I check existing connection string with the following code

在此输入图像描述

STRANGE !!! I dont have above connection string !!!

Do you have the connection string in your WCF service library app.config? Depending on how it is being hosted, it could be looking it there.

I do not know the reason but this has occurred for me whenever I use three-tier programming. The solution for this problem is simple.
First, copy the configuration file which is located in your DataAccessLayer and place it (paste) to the location in which the configuration file of the program is (you have to replace the configuration file of the BusinessLayer with the configuration file of the DataAccessLayer).
Second, Add the following DLLs to the references of your presentation layer:
EntityFramework.dll
EntityFramework.SqlServer.dll
EntityFramework.SqlServer.dll
EntityFramework.dll


Mentioned DLLs can be found inside the debug or release folder of DataAccessLayer.
Good Luck :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM