locked
Web API Help Pages added to a Web Application RRS feed

  • Question

  • User-1605345584 posted

    Hello,

    I've read in a number of places that it is possible to install Microsoft.Aspnet.WebApi.HelpPage even when the project is not an MVC project.  When I install it, the Areas folder and contents does not get created.  It sounds like installing this creates a sort of hybrid.  Does anyone know what needs to be done in order for the installation to work correctly?

    Thanks,

    - N

    Tuesday, May 12, 2020 6:21 PM

All replies

  • User475983607 posted

    Web API uses routes not folders.   Can you clarify how your Web API works and the version of Web API?

    Tuesday, May 12, 2020 7:24 PM
  • User-1605345584 posted

    Hello. I have a web application (not MVC) to which I added a folder called API and to that added an APIController.  I believe it is Web API Controller v2.1.  Routes are setup for the API only.

    To add to my request...

    There is an article which explains that even with a web application, you can add the Microsoft.Aspnet.WebAPI.HelpPage functionality.  It does not require an MVC project, but when installed is supposed to add the Areas folder into which there will be the logic for the pages.  It tells the reader to add the inclusion of Areas into scope and adding a reference to System.Web.Mvc at the same time.  I do it as described, but I do not get the Areas folder or its contents.  I'm not sure what's preventing that.

    Tuesday, May 12, 2020 7:33 PM
  • User475983607 posted

    As I understand, you are following an unknown tutorial that illustrates how to add Web API to an existing Web Forms Project then include HelpPages?  Can you provide a link to the tutorial and the step where you are stuck?

    I built a demo and all I had to do is add the HelpPage NuGet package.  Then configure Areas

        public class Global : HttpApplication
        {
            void Application_Start(object sender, EventArgs e)
            {
                // Code that runs on application startup
                AreaRegistration.RegisterAllAreas();
                GlobalConfiguration.Configure(WebApiConfig.Register);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
            }
        }

    I used the following reference doc to get Web API working in an existing Web Forms project.

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/using-web-api-with-aspnet-web-forms

    Tuesday, May 12, 2020 7:56 PM
  • User-1605345584 posted

    Hi.  This is the tutorial that I used to try and add the Help Pages.

    https://devblogs.microsoft.com/aspnet/enabling-asp-net-web-api-help-pages-for-asp-net-web-forms-applications/

    I have the web forms with web api working.  I install the Microsoft.AspNet.WebAPI.HelpPage nuget package and where I would expect to see the Areas folder, it is not there.  I think that is my problem.

    - N

    Friday, May 15, 2020 4:34 PM
  • User1535942433 posted

    Hi ncoppola,

    Accroding to your article,I create a test and I could see the Areas folder like the article.

    As far as I think,you need to note the tip of 'Since it’s still prerelease, make sure you set "Include Prerelease" in the NuGet package manager otherwise you won’t find it.' in the article.

    I suggest you could make sure to set "Include Prerelease".

    Best regards,

    Yijing Sun

    Tuesday, May 19, 2020 2:46 AM