AI OnAI Off
I got it to work like this. You need to make sure you call it before Configure. Unfortunatley HttpConfiguration does not like when there are multiple => configure() called.
using System; using System.Linq; using System.Web.Http; using EPiServer.Framework; using EPiServer.Framework.Initialization; namespace ServiceApi.Test.Business { [InitializableModule] [ModuleDependency(typeof(EPiServer.Framework.FrameworkInitialization))] public class TestAttributeRouting : IInitializableModule { public void Initialize(InitializationEngine context) { GlobalConfiguration.Configuration.MapHttpAttributeRoutes(); } public void Preload(string[] parameters) { } public void Uninitialize(InitializationEngine context) { //Add uninitialization logic } } }
The main reason we added this was becasue if other third party libraries were calling MapAttirbutes then there would be an error. If you are just using attibute routing then letting ServiceApi map them should be sufficient.
EPiServer Service API integration module provides a way to "delay" attribute based routing registartion and delegate that to some external code by adding following key to:
However this seems not to work properly. Tried following solutions:
Added this code to following places:
a) Added to Application_Start()
b) Added to overridden Global.RegisterRoutes()
c) Created initializable module with dependency to EPiServer.ServiceApi.IntegrationInitialization
Called directly GlobalConfiguration.Configuration.MapHttpAttributeRoutes() and then GlobalConfiguration.Configuration.EnsureInitialized().
None of these seems to have any effect.
ServiceApi services ends with error message like: