More in this section

Forums / Bugs & Issues / Web API Route Registration

Web API Route Registration

5 posts, 0 answered
  1. Luke
    Luke avatar
    8 posts
    Registered:
    12 Oct 2015
    30 Nov 2015
    Link to this post

    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:

    https://gist.github.com/luke-barnett/e1b73958880dfbab5a6d

  2. Luke
    Luke avatar
    8 posts
    Registered:
    12 Oct 2015
    03 Dec 2015
    Link to this post
    Anyone able to help with this?
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    03 Dec 2015
    Link to this post

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

  4. Moiz
    Moiz avatar
    0 posts
    Registered:
    20 Oct 2014
    03 Oct 2016 in reply to Steve
    Link to this post

    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

     

     

  5. Chris
    Chris avatar
    0 posts
    Registered:
    08 Apr 2015
    16 Jan in reply to Moiz
    Link to this post

    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

5 posts, 0 answered