簡體   English   中英

獲取請求的 Web Api 響應錯誤 - System.Reflection.TargetInvocationException - 500 內部服務器錯誤

[英]Web Api response error for get request - System.Reflection.TargetInvocationException - 500 internal server error

當我使用 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.

// GET: api/MovieHallDetails
public IQueryable<MovieHallDetails> GetMovieHallDetails() { 
        return db.MovieHallDetails;
}

這些是我用 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.

這是我在 Postman 測試時返回的結果

500內部服務器錯誤

塊引用

MovieHallDetails沒有無參數構造函數。 添加參數構造函數后,問題解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM