Try our conversational search powered by Generative AI!

A route named 'MS_attributerouteWebApi' is already in the route collection. Route names must be unique. Parameter name: name

Vote:
 

So I pulled down the latest QuickSilver source from the github repo, installed the EpiServer.ServiceAPI.Commerce package, and I'm getting the following error. Any suggestions?

Server Error in '/' Application.

A route named 'MS_attributerouteWebApi' is already in the route collection. Route names must be unique.
Parameter name: name

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: A route named 'MS_attributerouteWebApi' is already in the route collection. Route names must be unique.
Parameter name: name

Source Error:

[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\d32108b6\ada22941\App_global.asax.1jtrchz-.0.cs    Line: 0

Stack Trace:

[ArgumentException: A route named 'MS_attributerouteWebApi' is already in the route collection. Route names must be unique.
Parameter name: name]
   System.Web.Routing.RouteCollection.Add(String name, RouteBase item) +3173975
   System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.Add(String name, IHttpRoute route) +30
   System.Web.Http.Routing.AttributeRoutingMapper.MapAttributeRoutes(HttpConfiguration configuration, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider) +115
   System.Web.Http.HttpConfigurationExtensions.MapHttpAttributeRoutes(HttpConfiguration configuration) +57
   EPiServer.ServiceApi.IntegrationInitialization.b__0(HttpConfiguration config) +247
   System.Web.Http.GlobalConfiguration.Configure(Action`1 configurationCallback) +27
   EPiServer.ServiceApi.IntegrationInitialization.Initialize(InitializationEngine context) +133
   EPiServer.Framework.Initialization.<>c__DisplayClass5.b__4() +19
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +43
   EPiServer.Framework.Initialization.ModuleNode.Initialize(InitializationEngine context) +80
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +173

[InitializationException: Initialize action failed for Initialize on class EPiServer.ServiceApi.IntegrationInitialization, EPiServer.ServiceApi, Version=2.0.1.59, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +439
   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +116
   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +475
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +83
   EPiServer.Global..ctor() +76
   EPiServer.Reference.Commerce.Site.Global..ctor() +29
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\d32108b6\ada22941\App_global.asax.1jtrchz-.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, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1117
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +263
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9923088
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.118.0 

#142088
Nov 30, 2015 17:45
Vote:
 

Looks like i have to disable attribute routing?

#142089
Nov 30, 2015 17:47
Vote:
 

Hi,

Make sure you don't have any code which call GlobalConfiguration.Configure(config => config.MapHttpAttributeRoutes()). By default ServiceAPI will register that - so you don't have to.

Regards.

/Q

#142098
Nov 30, 2015 21:04
Vote:
 

In Quicksilver use this appsetting to get around the issue

<add key="episerver:serviceapi:maphttpattributeroutes" value="false" />
#176390
Mar 17, 2017 13:33
* 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.