繁体   English   中英

POST 500(内部服务器错误)asp.net mvc

[英]POST 500 (Internal Server Error) asp.net mvc

我正在尝试将对象发布到json服务器中,但出现了500个内部服务器错误。 在这段代码中,在localHost上工作正常,但无法正常工作,我的代码中有任何错误

$.ajax({
  type: 'POST',
  url: '/Booking/CheckAvailability',
  dataType: 'json',
  cache: false,
  data: { 
    LocationID: locationID, 
    VenueID: venueID, 
    FacilityID: facilityID, 
    BookedFromDate: bookedFromDate, 
    BookedToDate: bookedToDate, 
    FromTime: fromtime, 
    ToTime: Ttime 
  },
  traditional: true,
  success: function (data) {
    if (data.success) {
      $("#VenueBooking").show();
    }
    if (data.False) {
      alert("Aleardy Booked");
    }
  },
  error: function (ex) {
    alert('Failed to retrieve Sub Categories : ' + ex);
  }
});

码:

[HttpPost]
        public ActionResult CheckAvailability(int locationID, int venueID, int facilityID, string bookedFromDate, string bookedToDate, string fromTime, string toTime)
        {

            try
            {
                Get_Location();
                if (ModelState.IsValid)
                {
                    locationInformation check = new locationInformation();
                    bool suc = check.CheckAvailability(bookedFromDate, bookedToDate, fromTime, toTime);
                    if (suc == false)
                    {
                        return Json(new { success = true, message = "Checked successfully" }, JsonRequestBehavior.AllowGet);
                    }
                    else if (suc == true)
                    {
                        return Json(new { False = true, message = "Checked successfully" }, JsonRequestBehavior.AllowGet);
                    }
                }
                return View();
            }
            catch
            {
                return View();
            }
        }

如果您无法调试服务器,我将尝试查看浏览器开发人员工具中的“网络”选项卡。 希望您能了解为什么会引发错误。 选择失败的请求,然后查看响应。

尝试确保已添加CheckAvailabilty视图。 请参阅下面的答案:

找不到部分视图,或者没有视图引擎支持搜索到的位置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM