This is my controller
public class TutorController : ApiController
{
[Route("CreateTutor")]
public async Task<IHttpActionResult> CreateTutor(TutorModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
return Ok();
}
}
and I am using Fiddler to connect to it
POST http://localhost:12110/api/Tutor/CreateTutor
I have set raw and application/application
In Body I have
{
"Name": "Test"
}
But I get this error { "Message": "No HTTP resource was found that matches the request URI 'http://localhost:12110/api/Tutor/CreateTutor'.", "MessageDetail": "No action was found on the controller 'Tutor' that matches the request." }
Any idea what I am doing wrong?
Routeattribute you are overriding the default route in theWebApiConfigfile. Try accessing your controller with the following...it will probably work, thought it's probably not what you want: localhost:12110/CreateTutor - Kenneth K.