Why does JsonResult produce 500 internal server error?

后端 未结 1 1079
一个人的身影
一个人的身影 2021-01-18 05:08

I am trying to retrieve a value from my Microsoft SQL Server database. It is a nullable \"bit\".

The code to retrieve

[HttpGet]
public JsonResult Wi         


        
相关标签:
1条回答
  • 2021-01-18 05:22

    The problem is most likely because ASP.NET MVC does not allow JSON requests using GET by default. You can add JsonRequestBehavior.AllowGet as a second parameter to your Json call:

    return Json("true", JsonRequestBehavior.AllowGet);
    

    If not, can you provide a error message?

    0 讨论(0)
提交回复
热议问题