nishihara.me


navigation
home
twitter
github
flickr
about
I am a developer and photography enthusiast.

Enable .net MVC Help Pages with OWIN and Katana

25 Aug 2015

I was having a problem when developing a Web Api 2 project with Owin: help page were not generated as I expected. I followed the tutorial Creating Help Pages for ASP.NET Web API and yet, it was missing something to get it working with OWIN and KATANA.

Searching through the internet I found this answer on StackOverflow: Can’t get ASP.NET Web API 2 Help pages working when using Owin.

The solution is simple:

  • On OWIN Startup.cs or equivalent file, expose HttpConfiguration and register the help page area with AreaRegistration.RegisterAllAreas():

     public class Startup 
     { 
         public static HttpConfiguration HttpConfiguration { get; private set; } 
         public void Configuration(IAppBuilder app) 
         { 
             HttpConfiguration = new HttpConfiguration();
      	   AreaRegistration.RegisterAllAreas(); 
      	   WebApiConfig.Register(HttpConfiguration);
      	   app.UseWebApi(HttpConfiguration); 
          } 
     } 
    
  • Replace all the GlobalConfiguration.Configuration with Startup.HttpConfiguration, in my case, only in HelpPageAreaRegistration.RegisterArea and in HelpController constructor.