[英]Web Api response error for get request - System.Reflection.TargetInvocationException - 500 internal server error
When I debug it using Postman, it could invoke the Web Api method.当我使用 Postman 调试它时,它可以调用 Web Api 方法。 The controller is scaffolded using option "Web Api 2 Controller with actions, using Entity Framework" in .NET Framework 4.6.1, Web Application Web, Api project.
The controller is scaffolded using option "Web Api 2 Controller with actions, using Entity Framework" in .NET Framework 4.6.1, Web Application Web, Api project.
// GET: api/MovieHallDetails
public IQueryable<MovieHallDetails> GetMovieHallDetails() {
return db.MovieHallDetails;
}
These are the sample data in the table when I select it with SQL select query:这些是我用 select 和 SQL select 查询时表中的示例数据:
Id MovieHallId Seats SeatStatus
297 9 1,1 0
298 9 1,2 0
299 9 1,3 0
300 9 1,4 0
I also have many other similar Web Api methods for other tables and I could issues get request and able to get the successful web api response except for this one. I also have many other similar Web Api methods for other tables and I could issues get request and able to get the successful web api response except for this one.
These is what return back when I test it at Postman这是我在 Postman 测试时返回的结果
500 internal server error 500内部服务器错误
Blockquote
块引用
The MovieHallDetails
does not have parameterless constructor. MovieHallDetails
没有无参数构造函数。 After added parameterles constructor, problem solved.添加参数构造函数后,问题解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.