Web API Route Registration

Posted by Community Admin on 04-Aug-2018 04:32

Web API Route Registration

All Replies

Posted by Community Admin on 30-Nov-2015 00:00

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:

gist.github.com/.../e1b73958880dfbab5a6d

Posted by Community Admin on 03-Dec-2015 00:00

Anyone able to help with this?

Posted by Community Admin on 03-Dec-2015 00:00

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")
    

Posted by Community Admin on 03-Oct-2016 00:00

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

 

 

Posted by Community Admin on 16-Jan-2017 00:00

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:

http://www.sitefinity.com/developer-network/forums/developing-with-sitefinity-/web-api-2-attribute-routing

This thread is closed