Web API Route Registration
Hey,
I'm trying to sort out getting web api routing registered without it crashing after a site restart.
I am running the latest version of Sitefinity 8.2.5904
The first boot everything works fine and then if I do something like disable/enable a module it redoes the Sitefinity bootstrapper code and my webapi routes crash with
"The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code."
Here is the code that I'm running:
Anyone able to help with this?
We do all outs in Initalized... give it a try?
protected
void
Application_Start(
object
sender, EventArgs e)
//JsConfig.DateHandler = DateHandler.ISO8601;
Bootstrapper.Initialized +=
new
EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
void
Bootstrapper_Initialized(
object
sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
Config.RegisterSection<Medportal.Sitefinity.Config.MedportalConfig>();
//Telerik.Sitefinity.Configuration.Config.RegisterSection<RandomSiteControls.Configuration.SitefinitySteveConfig>(); //Random site controls (tabstrip\etc)
if
(e.CommandName ==
"Bootstrapped"
)
We are running in same issue with Sitefinity 9.0
When we register Web API routes on
if (e.CommandName == "Bootstrapped") //RegisterRoutes(GlobalConfiguration.Configuration); GlobalConfiguration.Configure(RegisterRoutes);
Sitefinity Loads infinitetly and never shows up home page
Please help
Regards,
Moiz
I'm having the same issue. Trying to run
GlobalConfiguration.Configure.config.MapHttpAttributeRoutes()
causes the site loading to run infinitely. This is preventing me from using RouteAttributes in Web Api2 in my site.
[edit]
I was able to solve my issue: