Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • charlie black 33 posts 106 karma points
    Nov 14, 2017 @ 22:26
    charlie black
    0

    error after login to BackOffice for migrated MVC 4 web app that runs side-by-side with umbraco 7.5.6

    We created an MVC 4 web application more than 3 years ago that ran side-by-side with umbraco 4.7.2 (used the old UmbraMVCo). We successfully upgraded the umbraco to 6.1.6 about 2 years ago I think. This was also completed successfully. Now because we need to continue to upgrade the libraries for the ASP.NET MVC 'part' of the web application we needed to upgrade the umbraco as well. 7.4.3 was the minimum possible but we decided on 7.5.6. We were able to successfully nuget install the umbraco and get the web app to run. This all works. But when we login into the BackOffice we get an error soon after clicking Login. Running from Visual Studio, in the Chrome console, I can see that after Login there is https://localhost:44300/umbraco/backoffice/UmbracoTrees/ApplicationTree/GetApplicationTrees?application=content&tree=&isDialog=false 500 (Internal Server Error) The response body, json is: {"Message":"An error has occurred.","ExceptionMessage":"A route named 'WebAPI/Lanugages/GetAllLanguages' is already in the route collection. Route names must be unique. Parameter name: name","ExceptionType":"System.ArgumentException","StackTrace":" at System.Web.Routing.RouteCollection.Add(String name, RouteBase item)

    The full stack trace takes up too much.

    The Named route is one of our custome ApiController descended web api controllers: [Authorize(Roles = "CacheAdmin")] [HttpGet] [Route("cache/clear", Name = "WebAPI/Languages/GetAllLanguages")] public void ClearLanguageCache() { UserLanguageRepository.Reload(); }

    When I look at the route collection after application start, there are 63 routes. When I debug into code after clicking Login, I see that umbraco is trying to re-add to this 63 member collection, the same routes that were originally added to the collection at application start. It's no wonder the exception. The only way I can get past this error, is by modifying the Route attribute for all 19 ApiController methods that use Name= amd remove the Name e.g, change [Route("cache/clear", Name = "WebAPI/Languages/GetAllLanguages")] to [Route("cache/clear")]

    Why, after clicking login to the BackOffice, does umbraco proceed to add all these routes again - they are already added at application_start?

Please Sign in or register to post replies

Write your reply to:

Draft