Solved

New 21R2 Instance, "An item with the same key has already been added."

  • 9 November 2021
  • 5 replies
  • 219 views

Userlevel 1

I am trying to install a new instance on my local machine of 21R2 and when trying to access the instance immediately after install, I get an “An item with the same key has already been added.” error message.

I’ve tried two separate builds (first and latest) and get the same.  Some of our other team members are using 21R2, but they all updated from 21R1 to get there.  I guess I can go that route if needed, but I would prefer to get a new instance of 21R2.   

The stack trace follows below.   Any insight would be greatly appreciated.

Stack Trace:
 


[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +60
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +14338200
System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +302
Microsoft.Extensions.DependencyInjection.AspNetCoreServiceCollectionExtensions.AddMarkedAssemblies(ApplicationPartManager applicationPartManager, IReadOnlyList`1 allAssemblies) +198
Microsoft.Extensions.DependencyInjection.<>c__DisplayClass0_0.<AddAspNetCore>b__2(ApplicationPartManager applicationPartManager) +19
Microsoft.Extensions.DependencyInjection.MvcCoreMvcBuilderExtensions.ConfigureApplicationPartManager(IMvcBuilder builder, Action`1 setupAction) +56
Microsoft.Extensions.DependencyInjection.AspNetCoreServiceCollectionExtensions.AddAspNetCore(IServiceCollection services, IReadOnlyList`1 assemblies) +426
PX.Web.Startup.ConfigureServices(IServiceCollection services) +139
PX.Data.DependencyInjection.LoggingStartupWrapper.PX.Hosting.IStartup.ConfigureServices(IServiceCollection services) +180
PX.Hosting.HostBuilder.CreateServiceProvider(HostBuilderContext hostBuilderContext, IEnumerable`1 configureServicesActions, Func`2 providerFactory, IEnumerable`1 configureContainerActions) +435
PX.Hosting.HostBuilder.Build() +146
PX.Data.DependencyInjection.CompositionRoot.CreateContainer(Configuration configuration) +577
PX.Web.PXApplication.Application_Start(Object sender, EventArgs e) +124

[HttpException (0x80004005): An item with the same key has already been added.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +517
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): An item with the same key has already been added.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724

 

 

icon

Best answer by JKurtz29 26 January 2022, 16:30

View original

5 replies

Userlevel 1

I had to install a new 21R1 instance and upgrade it to 21R2. 

Userlevel 4
Badge

Hi JKurtz,

I have not seen this error before. It looks as if the definition of the instance is not right in IIS.

I installed Build 21.201.0086 and

  1. the sites upgrade to 2021 R2 are OK
  2. a new site created on 2021 R2 is also OK

So, it seems the error is related to your environment . You may want to confirm the installed Acumatica build and review the instance info. If you share it , I can compare that with what I have here. 
 

Cheers

Userlevel 3
Badge +1

I have a prospect who had the same issue on version 21.200.0145.  We are switching them back to a previous version for now.

Userlevel 1

I was able to install a new 21R1 instance and upgrade it to 21R2, however, I just can’t install a new 21R2.

I currently have 18 different instances of Acumatica installed in order to do various work on various customers’ data (and their respective versions).  I’ve had multiple versions installed for several years and this is the first time I’ve had a problem installing a new instance.

Here is a screen shot of the ERP Configuration wizard.  The “21R2” instance highlighted is the new instance that was installed as 21R1 and upgraded.  Don’t mind the black-outs, I did that to hide customer names.  But as you can see, I have multiple instances with various versions, all working OK.

I go through each step of creating a new 21R2 instance, doing it the way I’ve always done it:

For the database server connection, I take the defaults:

 

I use the same name for the database / instance / virtual directory / app pool.  In this example, I’ll be using 2021R2:

 

Inserting SalesDemo data:

 

Taking defaults for Database connection.  (No difference if I use Windows or SQL authentication):

 

Set the instance name and path:

 

I always create each new instance in its own App Pool:


Confirmation (top part)

 

Confirmation (bottom part so you can see all settings):

 

Installing….

Inserting demo data…

 

Installed:

 

And this time it works.  Go figure.

 

In all seriousness, I didn’t change any steps.  That’s the way I always do it, and it simply wasn’t working yesterday, and I tried several times.  The only thing different between yesterday and today is that I uninstalled 21R2, re-installed 21R1, created a new instance calling it “21R2” even though it was 21R1, then re-installed 21R2, and then upgraded the “21R2” instance to 21R2.

Maybe the uninstall / reinstall of 21R2 had something to do with fixing whatever was broken?

Userlevel 7
Badge

Hi @JKurtz29 were you ever able to resolve this? Thanks!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2022  Acumatica, Inc. All rights reserved