title: Web api: The requested resource does not support http method 'GET'
body: <p>I created an API controller on my MVC4 project</p>
  
  <p>Here is the method I created to test the functionality of the API</p>
  
  <pre><code>private string Login(int id)
  {
      Employee emp = db.Employees.Find(id);
      return emp.Firstname;
  }
  </code></pre>
  
  <p>When I try to access this api with <code>localhost:xxxx/api/controllerName/Login?id=2</code>, I get</p>
  
  <blockquote>
    <p>{"$id":"1","Message":"The requested resource does not support http method 'GET'."}</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <p>Also, here is my api config file</p>
  
  <pre><code>public static void Register(HttpConfiguration config)
      {
          config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
  
          var json = config.Formatters.JsonFormatter;
          json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
          config.Formatters.Remove(config.Formatters.XmlFormatter);
      }
  </code></pre>