Try our conversational search powered by Generative AI!

EPiServer Marketing Testing Tools is breaking my site


I have a site that uses a lot of webapi 2 within it and now we wanted to try out the EPiServer Marketing Testing Tools.

The installations worked great but suddently all my web api pages stopped working and giving me the error "The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code."

I rememberd to have had this problem before when we were trying out Episerver Service Api so I identified it to be how we initialize our routes that do not work with how you are initialize your web api routes.

We do it in global.asax with override of RegisterRoutes and in application_start like this:


                name: "[OURAPICALLNAME]",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional });


How should I change this to make it work with the new Marketing Testing Tools?

Feb 15, 2017 9:21

Hi Henrik

I am not sure of the exact answer to your question but I think the Marketing tools makes use of the interceptor feature as described here: and here: and it sounds like it could be intercepting your WebAPI requests too? I could be completely wrong of course!

You could try registering your routes in an Episerver init module and ensuring it executes after the Marketing Testing tools init module EPiServer.Marketing.Testing.Web.Initializers.PublishContentEventListener this will ensure the code you supplied does at least execute after anything the Marketing Testing tools has done.


Feb 15, 2017 17:00

Hi David,

I know how to write initialization modules but how would one write to code to ensure that it runs AFTER the marketing testing tools? Or after any other module?

Currently experiencing the same problems as Henrik frown

Apr 28, 2017 15:56

Hi Marcus

You can use the Episerver Debugging tools to look for all init modules: and look for the marketing testing init module.

Then add a dependency on the Marketing testing init module using the following:

[ModuleDependency(typeof([Name of Marketing testing module]))]


May 02, 2017 13:06

Thanks for the link to the EPiServer Debugging tools - a hidden gem!

I managed to solve my problems by using the following code:

public class MyInitializationModule : IInitializableModule
	public void Initialize(InitializationEngine context)
		// Enable Web API routing
		GlobalConfiguration.Configure(config =>
			// Activate CORS

			// Attribute routing

			// Convention-based routing
				name: "ActionApi",
				routeTemplate: "webapi/{controller}/{action}/{id}",
				defaults: new { id = System.Web.Http.RouteParameter.Optional }

I took dependency on EPiServer.Framework.FrameworkInitialization instead of EPiServer.Web.InitializationModule.

Edited, May 02, 2017 15:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.