Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8500097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:51:02+00:00 2026-06-11T00:51:02+00:00

Based on this blogpost http://codebetter.com/johnvpetersen/2012/08/01/documenting-your-asp-net-web-apis/ I’m writing a documentation-controller, pretty much as it’s done

  • 0

Based on this blogpost http://codebetter.com/johnvpetersen/2012/08/01/documenting-your-asp-net-web-apis/ I’m writing a “documentation-controller”, pretty much as it’s done in the above link. However when I make the following call

GlobalConfiguration.Configuration.Services.GetApiExplorer().ApiDescriptions

I get a InvalidOperationException stating: “This method cannot be called during the application’s pre-start initialization phase.“. I’ve had a look at ASP.NET: This method cannot be called during the application's pre-start initialization stage but that didn’t solve it for me. I’m on ASP.NET Web API 4.20710.0, which is the latest according to NuGet (yes?).

Anyone care to provide me with some help on the issue? Is it f.ex. possible to force the pre-start initialization phase to finish before I make the call to ApiDescriptions? Or can it perhaps be tweeked another way?

Thanks for any input!

EDIT

The call is made from within a GET

public List<APIEndPoint> Get()
{
  var controllers = GlobalConfiguration
    .Configuration
    .Services
    .GetApiExplorer()
    .ApiDescriptions; 
  ... 
}

The above link provides a full example.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:51:04+00:00Added an answer on June 11, 2026 at 12:51 am

    I realised, after decopiling the System.Web.Http assembly, that there the most probable cause to this was the ApiExplorers inner collection Lazy<Collection<ApiDescription>> that had, for reasons I dont’t know, not been properly initialized or had been set in an inaccessibale state, causing the exception. I solved the issue by newing up a ApiExplorer. In my ApiController:

    public List<APIEndPoint> Get()
    {
        var apiEx = new ApiExplorer(ControllerContext.Configuration);
        var controllers = apiEx.ApiDescriptions;
    
        ...
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing url rewriting (Wildcards) for a sigle web site based on this blog
I am reading a blogpost at: http://flyingfrogblog.blogspot.com/2009/07/ocaml-vs-f-burrows-wheeler.html a simple implementation for Burrow Wheeler compressing
I'm following this blog post about setting up ELMAH with MVC: http://dotnetdarren.wordpress.com/2010/07/27/logging-on-mvc-part-1/ I've only
See the bullets on this blog post: http://www.nielsbrinch.com/managing-expectation-management/ I have had to change to
I am following this tutorial http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics . As per this tutorial,when i pass a
I need to cache http responses, and based on this blog post that functionality
I am building an ASP.NET 4.0 MVC 2 app with a generic repository based
This blog post of December 2008 says that rubygems is broken on Debian-based systems.
Based on this article I was able to get the FullName to work rather
Based on this question I've created a small application which is catching all debug

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.