Note that there are some explanatory texts on larger screens.

plurals
  1. PONo type was found that matches the controller named 'help'
    primarykey
    data
    text
    <p>I have been following <a href="http://blogs.msdn.com/b/yaohuang1/archive/2012/05/21/asp-net-web-api-generating-a-web-api-help-page-using-apiexplorer.aspx" rel="nofollow">this guide</a> to add a help page to document my Web API project. My Controller is named HelpController and I have a route that I am trying to use to map the Index action to /Help. This is the only MVC controller in the project. Because the rest are Web API controllers, we removed the "/api" prefix from the default route in WebAPIConfig.cs.</p> <p>The HelpController:</p> <pre><code>public class HelpController : Controller { public ActionResult Index() { var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); return View(apiExplorer); } } </code></pre> <p>And route config:</p> <pre><code>public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "help", defaults: new { controller = "Help", action = "Index"}); } } </code></pre> <p>In Global.asax.cs</p> <pre><code>protected void Application_Start() { // .. WebApiConfig.Register(GlobalConfiguration.Configuration); RouteConfig.RegisterRoutes(RouteTable.Routes); // .. } </code></pre> <p>But when I try to navigate to /help in the browser I get the following error message.</p> <pre><code>&lt;Error&gt; &lt;Message&gt;No HTTP resource was found that matches the request URI 'http://localhost/ws/help'.&lt;/Message&gt; &lt;MessageDetail&gt;No type was found that matches the controller named 'help'.&lt;/MessageDetail&gt; &lt;/Error&gt; </code></pre> <p><strong>EDIT</strong>: The message contains /ws/help as the application is hosted at localhost/ws in IIS.</p> <p>Does anyone know what could be causing ASP.NET to not find my HelpController?</p> <p><strong>UPDATE</strong>: If I change the order of RouteConfig and WebApiConfig registration calls in Application_Start I get a 404 instead.</p> <pre><code>protected void Application_Start() { // .. RouteConfig.RegisterRoutes(RouteTable.Routes); WebApiConfig.Register(GlobalConfiguration.Configuration); // .. } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload