ConfigurationManager.ConnectionStrings [&"XXX&"]返回null [英] ConfigurationManager.ConnectionStrings["XXX"] is returning null
本文介绍了ConfigurationManager.ConnectionStrings [&"XXX&"]返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个控制台应用程序,其中将网站项目添加为dll.调用内部dll ConfigurationManager.ConnectionStrings ["XXX"]
,该DLL始终返回 null
.
I have a console application in which website project is added as dll. Inside dll ConfigurationManager.ConnectionStrings["XXX"]
is called which is always returning null
.
但是dll中的web.config具有名为"XXX"的连接字符串.任何人都可以建议出什么问题了吗?
But web.config in dll has connectionstring named 'XXX'. Can any one suggest what is going wrong?
推荐答案
我认为.dll的.config文件不会与dll一起添加到您的控制台项目中.您需要在执行的项目中具有.config.
I don't think .config file of the .dll is added to your console project together with the dll. You need to have the .config in your executing project.
这篇关于ConfigurationManager.ConnectionStrings [&"XXX&"]返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文