mercredi 6 janvier 2016

Could not find the controller end point when passing a string as a parameter in Web API 2 put as async

Code for controller

[Authorize]
[HttpPut]
[Route("TopHandler/{studentId}")]
public async Task<HttpResponseMessage> CreateClass(string studentId, String projectId)
{
    var response = await Task.Run(() =>
    {
        //  Some Code here
    });

    return response;
}

Code for Controller call

 await VML.Client.PutAsJsonAsync("TopHandler/" + studentId, projectId);

Unfortunately this end point cannot be found by the request and it gives 404 I am passing a string as a parameter . What would possibly go wrong here ?




Aucun commentaire:

Enregistrer un commentaire