Skip to main content
Solved

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

  • 9 November 2021
  • 5 replies
  • 538 views

JKurtz29
Jr Varsity III
Forum|alt.badge.img

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

 

 

Best answer by JKurtz29

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

View original
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img+1

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


JKurtz29
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 15 replies
  • November 10, 2021

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?


Kulvir Kaila
Jr Varsity I
Forum|alt.badge.img+2
  • Jr Varsity I
  • 60 replies
  • November 11, 2021

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.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2642 replies
  • January 24, 2022

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


JKurtz29
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 15 replies
  • Answer
  • January 26, 2022

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings