samedi 22 avril 2017

Web API 2 Attribute Routing Not working

I Have this API method:

 public class UsersController : ApiController
{

    [HttpGet]
    [Route("Users")]
    string GetUsers()
    {
        return "Aye";
    }
} 

And this routing in config:

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.MapHttpAttributeRoutes();
    }
}

I host the API on IIS (localhost:8000) , give the site all the required permissions and when I try to call http://localhost:8000/Users it says:

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Please help.




Aucun commentaire:

Enregistrer un commentaire