Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized...

$
0
0

Hi!

After doing a test upgrade to the very latest EPiServer version, along with 'EPiServer.Marketing.Testing 2.2.3', I'm now facing the following error when calling my own Web API:

The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code.

Does anyone have a way of resolving this issue?

The start of my Global.asax.cs looks like this:

public class Global : EPiServer.Global
    {
        protected void Application_Start()
        {
			// Enabling bundling and minification
			BundleConfig.RegisterBundles(BundleTable.Bundles);
			// Enable Web API routing
			GlobalConfiguration.Configure(config =>
			{
				// Activate CORS
				config.EnableCors();
				// Attribute routing
				config.MapHttpAttributeRoutes();
				// Convention-based routing
				config.Routes.MapHttpRoute(
					name: "ActionApi",
					routeTemplate: "webapi/{controller}/{action}/{id}",
					defaults: new { id = System.Web.Http.RouteParameter.Optional }
				);
			});

I've tried adding GlobalConfiguration.Configuration.EnsureInitialized(); to a couple of places but it still won't work.

Thanks in advance!


Viewing all articles
Browse latest Browse all 9076

Trending Articles