条目“'已经被添加错误
我在ASP.net web.config给我configuration错误。
<connectionStrings> <add name="conn1" connectionString="Data Source=test;database=test;uid=test;pwd=test"/> <add name="conn2" connectionString="Data Source=123.123.1.123;database=test2;uid=test;pwd=test"/> ... 它会抛出“input'conn2'已被添加。” 错误。 我知道我只加了一次。 不知道什么是错的。
它可以在web.config中,这是父亲。 只需添加
 <remove name="conn2" /> 
在你添加之前(再):)
或者使用清除所有连接string
 <clear /> 
 将任何提供程序添加到web.config时,应该使用<clear /> 。 阅读这篇文章: http : //weblogs.asp.net/scottgu/archive/2006/11/20/common-gotcha-don-t-forget-to-clear-when-adding-providers.aspx 
上述问题的根本原因在于如何在web.config文件中注册新的提供者。
web.config文件中的部分被实现为一个集合,因此可以同时注册多个提供者
如果您有另一个项目使用相同的连接string名称,您将收到此错误,因为该连接string已被添加到集合。
如果你重写ToString()方法,那么这将工作。 看起来像configuration机制使用它来检查集合中是否已经存在