Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Info: The service api has a similar appsettingskey for disabling the same thing: https://world.optimizely.com/documentation/developer-guides/archive/service-api/installation-and-configuration/3-4/
Aftert installing EPiServer.CloudPlatform.Cms and the dependent package EPiServer.Cms.HealtCheck all my ApiControllers (web api) stopped working and I got his error. An important pice of information is that the web api's that got the error (se below) were set up this attribute routing!
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 have a webapiconfig.cs with a register method, where I call this:
And in Global.asax.cs I have this:
and also this in the end of Application_Start() in global.asax.cs:
My controller looks like this:
public class MyApiController : ApiController { [HttpGet] [Route("test")] public int test() { return 42; } }
So attribute routing is set up using GlobalConfiguration.Configure.MapHttpAttributeRoutes(), and after some reflection of the EPiServer.Cms.HealthCheck packages I figured out that this module also were calling GlobalConfiguration.Configure.MapHttpAttributeRoutes(), but that it was possible to disalbe.
SOLUTION: A appSetting key kan be used to disable the extra call to MapHttpAttributeRoutes for the HealthCheck module
This is setting is not documented any place by Optimizely, that I can find...