Reputation: 3021
I have created a Basic Webservice which gets invoked as per the Routing defined in the DTO.Here is my sample Routing Code..
[Route("/students", Verbs = "GET")]
[Route("/students/{id}", Verbs = "GET")]
public class StudentRequestDto
{
public int Id { get; set; }
}
Now when i am calling this webservice directly by http://localhost:1661/Students
URL i am able to get the response whereas when i am trying to call it by http://localhost:1661/Students?id=1
then i am getting NullReferenceException
.
Is my way of calling the Service second time by http://localhost:1661/Students?id=1
URL correct , if not what is the correct way..Thanks.
Upvotes: 1
Views: 26
Reputation: 442
[Route("/students/{id}", Verbs = "GET")]
only matches:
http://localhost:1661/students/1
Upvotes: 1