I have been going in circles with this issue. I have some custom Webapi routes to be implemented on my Umbraco 8 site.
I first added a ApplicationStartComponent that called the GlobalConfiguration.Configure(WebApiConfig.Register); . But then I got duplicate error due to this line being in the WebAPIConfig
Do the custom routes work if you 'just' call MapHttpAttributeRoutes() ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using Umbraco.Core.Composing;
using Umbraco.Web;
using Umbraco.Web.Mvc;
namespace Umbraco8.Components
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class RegisterCustomApiRoutesComposer : IComposer
{
composition.Components().Insert<RegisterCustomApiRoutesComponent>();
}
public class RegisterCustomApiRoutesComponent : IComponent
{
public void Initialize()
{
GlobalConfiguration.Configuration.MapHttpAttributeRoutes();
}
public void Terminate()
{
throw new NotImplementedException();
}
}
}
Custom WebApi routes
I have been going in circles with this issue. I have some custom Webapi routes to be implemented on my Umbraco 8 site.
I first added a ApplicationStartComponent that called the GlobalConfiguration.Configure(WebApiConfig.Register); . But then I got duplicate error due to this line being in the WebAPIConfig
So I followed the instructions in this issue https://github.com/umbraco/Umbraco-CMS/issues/4775 implemented the following code
This code meant that the Custom WebAPI works. However when I try and login to the Umbraco backoffice I get a 500 error.
Any suggestions?
Hi Nadia
Do the custom routes work if you 'just' call MapHttpAttributeRoutes() ?
regards
Marc
Oh brillant, thanks that worked... was staring at the wrong solution too long :)
is working on a reply...