I'm testing John Papa's new Hot Towel template. This is really a stain, but I have some difficulty in having it work with what I'm used to for the web API.
I managed to get around the routing problem, but I still can't get the Microsoft.AspNet.WebApi.HelpPage package to work.
Here is what I did:
- Install Hot Towel VSIX .
- New ASP.NET MVC4 Projct - Hot Towel SPA Template
- Build, Run - Works.
- Right-click the
Controllers folder, add a controller named TestController . - Select the "Empty API Controller" template.
Write the following action in TestController:
public IEnumerable<string> GetTestData() { return new[] { "A", "B", "C" }; }
Assembly, launch.
- Try URL
/api/test Get 404 error The resource cannot be found. - Try url
/api/test/gettestdata . Work.
Then I noticed that BreezeWebApiConfig.cs changed the default api route, and {action} is required, so I added the default api route:
GlobalConfiguration.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );
Now when I try the URL /api/test , it works.
Now I would like to use the help package.
- Add
Microsoft.AspNet.WebApi.HelpPage package nuget. - Add
AreaRegistration.RegisterAllAreas(); at Global.asax.cs - Assembly, launch.
When I try 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 pattern?
Should any of these be considered errors?
source share