Sitecore 8.2 update 1.

I have added few dll refences in project. The DLLs are from external application and have their own webapi controllers and routes.

I am using Autofac and excluding the assemblies from external application on startup (for builder.RegisterControllers)

When I navigate Experience Analytics dashboard, it errors out. The logs have a message that the route name "xxx" (external dll route) is already added to route collection and must be unique. But I do not see any other issue with the site. It looks like when I am navigating to Experience Analytics, it is trying to load the routes again.

When I remove the dlls from bin, there are no more errors in Experience Analytics.

I have added the names of the dll to be excluded in Sitecore.Mvc.config file section excludedAssemblies. Also I have added the same dlls to Sitecore.Services.Client.Config excluded assemblies section for Sitecore.Services.Infrastructure.Sitecore.Pipelines.ServicesWebApiInitializer, Sitecore.Services.Infrastructure.Sitecore

When I add the following:

    new ExcludeByControllerNameRouteProvider( "external dll name"));

to Global.asax, it throws an error

A route named 'MS_attributerouteWebApi' is already in the route collection.

So i reverted it.

  1. Why is Sitecore still adding routes from external dlls to the route dictionary?
  2. How do I exclude certain dll routes.


Here is the exception from Logs when i navigate to the experience analytics dashboard

System.ArgumentException: A route named 'CartLinesV1' is already in the route collection. Route names must be unique.
Parameter name: name
   at System.Web.Routing.RouteCollection.Add(String name, RouteBase item)
   at System.Web.Http.Routing.AttributeRoutingMapper.AddGenerationHooksForSubRoutes(HttpRouteCollection routeTable, IEnumerable`1 entries)
   at System.Web.Http.Routing.AttributeRoutingMapper.<>c__DisplayClass2.<MapAttributeRoutes>b__0(HttpConfiguration config)
   at System.Web.Http.HttpConfiguration.ApplyControllerSettings(HttpControllerSettings settings, HttpConfiguration configuration)
   at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
   at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
   at System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType)
   at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.SelectController(HttpRequestMessage request)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
16520 18:46:27 ERROR [Sitecore Services]: HTTP GET
URL http://preview.local/sitecore/api/ao/aggregates/all/786FBA3A4573445EA74504E3CA5E48C1/all?&dateGrouping=by-week&&dateFrom=19-10-2016&dateTo=19-01-2017&keyGrouping=collapsed 

The code that I am using to exclude certain dlls from Autofac register is:

    var assemblies = AppDomain.CurrentDomain.GetAssemblies();
    assemblies = assemblies.Where(x =>

I confirmed that it is not adding the external dlls to autofac ContainerBuilder.

  • please, provide: 1) Code that you use to exclude assemblies/routes 2) exception stacktrace from sitecore logs Jan 21 '17 at 19:46
  • added in the description. Jan 21 '17 at 22:28
  • can you check if you are using config.MapHttpAttributeRoutes(); somewhere in your global.asax? Jan 22 '17 at 8:49
  • I added config.MapHttpAttributeRoutes(); in gloabl.asax.cs thats when i get "A route named 'MS_attributerouteWebApi' is already in the route collection." error. So i removed it. Jan 23 '17 at 16:40
  • A strange that the error is only when I view Experience Analytics and Experience Profile from Launchpad. Almost looks like its initializing all the routes again when i view Experience Analytics or Experience Profile. Jan 23 '17 at 16:41

Browse other questions tagged or ask your own question.