I am trying out the new Hot Towel template from John Papa. It is really slick, but I'm having some difficulties getting it to cooperate with what I'm used to for Web API.
I was able to work around a routing issue, but I still can't get the Microsoft.AspNet.WebApi.HelpPage package to work.
Here's what I have done:
- Install the Hot Towel VSIX.
- New ASP.NET MVC4 Projct - Hot Towel SPA Template
- Build, Run - Works.
- Right-Click
Controllers
folder, Add Controller namedTestController
. - Choose "Empty API Controller" template.
Write the following action in the TestController:
public IEnumerable<string> GetTestData() { return new[] { "A", "B", "C" }; }
Build, Run.
- Try URL
/api/test
Get error 404The resource cannot be found.
- Try URL
/api/test/gettestdata
. Works.
Then I noticed that BreezeWebApiConfig.cs
has changed the default api route, and the {action} is required, so I added the default api route back in:
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Now when I try URL /api/test
, it works.
Now I'd like to use the help package.
- Add
Microsoft.AspNet.WebApi.HelpPage
nuget package. - Add
AreaRegistration.RegisterAllAreas();
toGlobal.asax.cs
- Build, Run.
When I try to the URL /Help
, I get the following error:
System.InvalidOperationException: The view 'Index' or its master was not found
or no view engine supports the searched locations.
The following locations were searched:
~/Views/Help/Index.aspx
~/Views/Help/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Help/Index.cshtml
~/Views/Help/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
What is the correct way to resolve this error without breaking the HotTowel template?
Should either of these be considered bugs?