【发布时间】:2015-10-09 17:58:45
【问题描述】:
我创建了一个基本 Web 服务,它根据 DTO 中定义的路由被调用。这是我的示例路由代码..
[Route("/students", Verbs = "GET")]
[Route("/students/{id}", Verbs = "GET")]
public class StudentRequestDto
{
public int Id { get; set; }
}
现在,当我通过http://localhost:1661/Students URL 直接调用此网络服务时,我能够得到响应,而当我尝试通过http://localhost:1661/Students?id=1 调用它时,我得到NullReferenceException。
我第二次通过http://localhost:1661/Students?id=1 URL 调用服务的方式是否正确,如果不是正确的方式是什么..谢谢。
【问题讨论】:
标签: .net web-services routing