title: Web Api 2 - No HTTP resource was found that matches the request URI
body: <p>I have an MVC project in my solution, which also has ApiControllers in it.
  I have set the project up in IIS and added it to the hosts file.</p>
  
  <p>The route looks like this:</p>
  
  <pre><code>GlobalConfiguration.Configuration.Routes.MapHttpRoute(
          name: "DefaultApi",
          routeTemplate: "api/{controller}/{action}/{id}",
          defaults: new { id = RouteParameter.Optional });
  </code></pre>
  
  <p>I added a controller called TestController inside the folder Project.Web/Controllers and it has one method, which simply return a string like this:</p>
  
  <pre><code>public class TestController : ApiController
  {
      public string Get()
      {
          return "Test";
      }
  }
  </code></pre>
  
  <p>If I try to reach my site via mysite.local/api/test/get i get the following error:</p>
  
  <pre><code>{
    "Message": "No HTTP resource was found that matches the request URI 'http://mysite.local/api/test/get'.",
    "MessageDetail": "No type was found that matches the controller named 'test'."
  }
  </code></pre>
  
  <p>But if I start the website from Visual Studio 17, I am able to reach localhost:portnr/api/test/get without any errors.</p>
  
  <p>I have tried to add <code>[Route()]</code> and <code>[RoutePrefix()]</code> without any success
  I have also tried to move the Apicontroller into Project.Web/Controllers/Api without any success</p>
  
  <p>Does anyone know why I am able to reach it via localhost, but not via domainname?</p>
  
  <p>Regards
  David</p>