U4-5017 - A route named 'umbraco-api-blah-blah' is already in the route collection

Created by Peter Flannery 29 May 2014, 23:52:42 Updated by Peter Flannery 30 May 2014, 19:13:31

I get the following error

"A route named 'umbraco-api-MyPlugin-MyCustomTree' is already in the route collection. Route names must be unique. Parameter name: name"

This happens when I put the following class in to the App_Code directory

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using umbraco.BusinessLogic.Actions;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;

namespace MvcApplication2.Areas.CustomTree.Controllers

	[Umbraco.Web.Trees.Tree("settings", "MyTree", "My custom tree", iconClosed: "icon-doc")]
	public class MyCustomTreeController : TreeController

		protected override TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings)
			var nodes = new TreeNodeCollection();
			var item = this.CreateTreeNode("dashboard", id, queryStrings, "My item", "icon-truck", true);
			return nodes;

		protected override MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings)
			var menu = new MenuItemCollection();
			menu.DefaultMenuAlias = ActionNew.Instance.Alias;
			return menu;



I have tried several different names but it still says the route exists for each new name.

Steps: I created a MVC 4 project in vs 2010 Used nuget to retrieve umbraco Setup instance ok Then added the class file above in to the app_code folder


Sebastiaan Janssen 30 May 2014, 08:39:14

First of all, you can't use Umbraco 7.1.4 with VS2010 as it doesn't support ASP.NET 4.5, this will cause you to see weird errors and this could be one of those weird errors. See: http://our.umbraco.org/documentation/Installation/system-requirements

The error suggests that this code is being ran twice, I've seen some weirdness with app_code before so it might be good to try and remove it and build it into an actual dll.

Make sure to head on out to the forum for more help unless you can reproduce this problem (which I can't on my 7.1.4 install using your class above).

Peter Flannery 30 May 2014, 11:22:23

Opps i meant vs 2012 (typo err on my phone)

Thanks for your feedback i will give it a try

Peter Flannery 30 May 2014, 19:13:31

I moved it to the root of an MVC area and it seems to be working fine now. thanks for you help.

Priority: Normal

Type: Bug

State: Can't Reproduce


Difficulty: Normal

Category: Extensibility

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.1.4

Due in version:


Story Points: