积极答复者
连接字符串错误

问题
-
连接字符串错误,在VS2010下正常,但是发布之后部署在IIS6.0下,却提示错误信息:
The entry 'MyConnString' has already been added.(‘MyConnString’条目已经被添加)
问题一:这是怎么回事?“WebConfig”中只有一个“MyConnString”连接字符串,项目中也只有这一个“WebConfig文件”,上一级目录(“D盘”)中也没有“WebConfig文件”,怎么会提示已填加?
问题二:使用“<remove name="MyConnString"/>”这样就好了,这是为什么?
问题三:怎样排查在“IIS6.0”下发挥作用的“WebConfig”文件?在一个站点(CEMS)下,有很多虚拟目录站点“DXX”、“DTX”等等,所有的“虚拟目录站点”都提示这个错误,这是为什么?到底“IIS6.0”下发挥作用的“WebConfig”文件在哪里?
IIS6.0下的三种配置属性,如下:
1、站点文件夹属性(IIS6.0站点目录下,右键)
2、站点属性(IIS6.0站点,右键)
3、虚拟目录属性(IIS6.0站点下虚拟目录,右键)
(图在下方,每次只能上传两张图。)
问题四:这三种属性配置有什么不同呢?各有什么功能???
WebConfig:
</location>
<connectionStrings>
<!--ZZQ: FOR TEST-->
<add name="MyConnString" connectionString="server=10.10.233.120;database=dx20120316;uid=sa;pwd=cems;"/>
<!--<add name="MyConnString" connectionString="server=10.10.233.120;database=cems0718;uid=sa;pwd=cems;"/>-->
</connectionStrings>
<system.web>
详细错误信息:
Server Error in '/DX' Application.
--------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The entry 'MyConnString' has already been added.
Source Error:
Line 40: <connectionStrings>
Line 41: <!--ZZQ: FOR TEST-->
Line 42: <add name="MyConnString" connectionString="server=localhost;database=dx20120316;uid=sa;pwd=cems;"/>
Line 43: <!--<add name="MyConnString" connectionString="server=localhost;database=cems0718;uid=sa;pwd=cems;"/>-->
Line 44: </connectionStrings>
Source File: D:\DX\web.config Line: 42
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
有精到广,做出自己的特色。
- 已编辑 starrycheng 2012年4月2日 4:51
答案
-
看起來有點像是組態繼承所造成的問題,或許你可以參考這篇文章。
http://msdn.microsoft.com/zh-tw/library/ms178685(v=vs.100).aspx
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/- 已标记为答案 BU XI - MSFTModerator 2012年4月9日 5:44
全部回复
-
3、虚拟目录属性(IIS6.0站点下虚拟目录,右键)
“回收应用程序池”怎么个说法???
把总站点下的其它的几个虚拟目录删除掉后,又莫名奇妙的好了,不解啊,不解???
有精到广,做出自己的特色。
- 已编辑 starrycheng 2012年4月2日 5:14
-
看起來有點像是組態繼承所造成的問題,或許你可以參考這篇文章。
http://msdn.microsoft.com/zh-tw/library/ms178685(v=vs.100).aspx
以上說明若有錯誤請指教,謝謝。
http://www.dotblogs.com.tw/terrychuang/- 已标记为答案 BU XI - MSFTModerator 2012年4月9日 5:44