Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Server Error in '/' Application. An item with the same key has already been added.

Vote:
 

Hi!

I suddenly got this message on our development server. What could it be? I cant remeber that I have done something strange. I made two ascx files, linked and used them on some page templates. Also I added a language (US english) in admin mode, because for some reason GB english doesnt work as intended.

Please keep in mind that Iam a newbie, so please explain well. Thank you very much. All right, here is the message:

 

Server Error in '/' Application.


An item with the same key has already been added.

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:

[No relevant source lines]


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6f1013d4\15642794\App_global.asax.bz3zj4ao.0.cs    Line: 0

Stack Trace:

[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +51
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +7464300
EPiServer.Web.UrlRewriteContext.InitializeLanguageResolving(IEnumerable`1 enabledLanguages) +163
EPiServer.Web.InitializationModule.InitializeUrlRewriteProvider(Settings settings, UrlRewriteElement rewriteSettings) +435
EPiServer.Web.InitializationModule.<StaticInitialization>b__5() +34
EPiServer.Web.InitializeEngine.Initialize() +228
EPiServer.Web.InitializationModule.StaticInitialization() +1107
EPiServer.Web.InitializationModule.Initialize(InitializationEngine context) +47
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +337
EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +82
EPiServer.Framework.Initialization.InitializationModule.StaticInitialization(HostType hostType) +154
EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +65
EPiServer.Global..ctor() +54
ASP.global_asax..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6f1013d4\15642794\App_global.asax.bz3zj4ao.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +221
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289


 

 

#54917
Nov 09, 2011 17:05
Vote:
 

Sounds like you have two languages with the same identifier or URL prefix.

#54922
Nov 09, 2011 20:59
Vote:
 

Hi Johan! Thanks for the reply. Ok, yeah, that was what I was leaning to also. How do I fix it? I cant get into admin mode. Is there another way? A file? The SQL? Thanks.

#54927
Nov 10, 2011 7:46
Vote:
 

If that's the case it should be just some minor data editing needed in tblLanguageBranch using SQL Server Management Studio.

I'm not sure we're on the right track though. A bit weird that Admin Mode let's you crash the whole app.

#54928
Nov 10, 2011 8:50
Vote:
 

Hi!

Iam in the database in SQL Management studio. I have clicked on dbo.tblLanguageBranch. I see the following: "Columns", "Keys", "Constraints", "Triggers", "Indexes" and "Statistics".

Can you tell me where I should go from here?

#54931
Nov 10, 2011 9:10
Vote:
 

What is this file?
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6f1013d4\15642794\App_global.asax.bz3zj4ao.0.c

Also i Visual Studio, in the project view (Solution explorer tree), there is a node named App_Data, there are two files there with question marks: EPiServerDB.mdf and EPiServerDB_log.LDF. What does those do? They dont exist. In the project view for another site we have they DO exists. What are those files? I havent messed with them. Why are they gone?

 

Many thanks!

#54935
Nov 10, 2011 9:36
Vote:
 

Right click tblLanguageBranch and choose Edit Top 200 Rows.

If you have use a connection string that points to a real SQL Server you can most likely delete the App_Data-folder from the project.

#54936
Nov 10, 2011 9:48
Vote:
 

It is not named tblLanguageBranch, it is named dbo.tblLanguageBranch. Is it the wrong one? It is under the node "Tables". If I right click on it I only see edit and that brings up some code, oh and also 'design' wich seems to be some wysiwyg edit mode.

Ok about the App_Data folder, nice to know.

Many thanks Johan for your support.

#54939
Nov 10, 2011 10:13
Vote:
 

Ah! Open table. I see a table. O' dear. en and en-gb have the same url. Is it here I fix it? How?
- Delete a row? - Put 'false' in the enabled column?

#54940
Edited, Nov 10, 2011 10:31
Vote:
 

dbo. is the owner of the table so you're in the right place.

Just click the "cell" and edit the text to en2 or something. Then select another row and the row will update itself.

Make sure your site has been restarted (reset web server, build the project or edit web.config) after editing.

#54946
Nov 10, 2011 11:09
Vote:
 

Johan: many many many thanks!! It worked. Strange as you said that some thing I did in admin mode could screw it up like this. I will try to get to the bottom with it, with the help of consultants maybe. But for now, the site works again. Have a great day!!

#54948
Nov 10, 2011 11:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.