在应用程序配置文件中找不到名为"xxxx"的连接字符串. WCF EF 6,除了那里 [英] No connection string named 'xxxx' could be found in the application config file. WCF EF 6, except it's there

查看:266
本文介绍了在应用程序配置文件中找不到名为"xxxx"的连接字符串. WCF EF 6,除了那里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有WCF服务.它使用围绕EntityFramework 6构建的几个DLL,我在我的网站和Web服务中使用它们,但是我突然发现其中一个找不到连接字符串.memberEnttites在同一代码段中工作,但是 coachingEntities没有.这是WCF项目中Web配置的一部分.我尝试替换WCF项目和Coaching项目.

I have a WCF service  that uses several DLLs built around the EntityFramework 6 , I use them in my web sites and web services, but I suddenly have one that cant find the connection string The memberEnttites works in the same segment of code, but the coachingEntities does not.  This is a fragment from the web config in the WCF project.  I have tried replacing both the WCF project and the Coaching project.

在Web窗体项目中使用相同的连接字符串即可.我已经从Coaching项目的app.config中复制了十几遍.

The same connection string works when used in the Web Forms projects. I have recopied it from the Coaching project app.config about a dozen times.

有什么想法吗?

推荐答案

.NET在运行时未在任何app.config中查找.它将在解决方案的运行时root.config中进行查找,例如根Web.config,或者如果它是exe项目类型即根项目,则该项目中的app.config必须包含所有配置 整个项目成功构建后,VS都会创建整个解决方案和runtime.config的信息. runtime.config称为programname.exe.config,它是从exe项目中的app.config派生的.程序名.exe.config 文件必须位于programname.exe文件的相同位置,以便.NET可以找到它.

.NET is not looking in any app.config at runtime. It's going to be looking in the runtime root.config of the solution, like the root Web.config, or if it's an exe project type that's the root project, the app.config in that project must contain all configuration information for the entire solution,  and a runtime.config is created by VS upon the succeful build of the project. The runtime.config is called programname.exe.config that was derived from the app.config in the exe project. The programname.exe.config file must be sitting at the same location of the programname.exe file so that .NET can find it.

您需要做的是确定root.config并获取该配置文件中的所有配置信息.

What you need to do is determine what is the root.config and get all configuration information in that config file.


这篇关于在应用程序配置文件中找不到名为"xxxx"的连接字符串. WCF EF 6,除了那里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆