' /'中的服务器错误应用程序 - 已添加具有相同键的项目

时间:2014-05-01 00:00:29

标签: asp.net visual-studio

我在页面加载时收到此错误。并非经常发生,当我点击刷新按钮时,错误就解决了。

已添加具有相同键的项目。

Description: An unhandled exception occurred during the execution of the current web     request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: An item with the same key has already been added.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)+9381419
AjaxControlToolkit.ToolkitScriptManagerHelper.GetAssembly(String name) +52     AjaxControlToolkit.ToolkitScriptManagerCombiner.IsScriptCombinable(ScriptEntry scriptEntry,  Boolean enableCdn) +27
 AjaxControlToolkit.ToolkitScriptManagerCombiner.WriteScripts(List`1 scriptEntries, TextWriter outputWriter, Boolean enableCdn) + 122                   AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedRegisteredScriptContent(Boolean  enableCdn) +206
    AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedScriptContentHash(HttpContextBase context, String[] bundles, Boolean enableCdn) +18

AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase context,    String[] bundles, Boolean forCombineAndMinify) +135

AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e) +215
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

1 个答案:

答案 0 :(得分:4)

基本错误表示正在使用相同的密钥将两个对象添加到同一个字典中,现在允许这样做。

额外的堆栈跟踪使我相信您正在为ToolkitScriptManagerCombiner添加两个具有相同名称的控件。

<强>更新

看起来这可能是最近的错误

http://ajaxcontroltoolkit.codeplex.com/workitem/27684

https://bugnet.codeplex.com/discussions/542489

使用旧版本的AjaxControlToolkit可以帮助您继续前进,直到问题得到解决。