我有一个页面发出AJAX请求来更新页面上的小定价部分。它在我的本地计算机上运行时可以正常工作,但是当发布到我们的开发服务器时,AJAX调用会收到内部服务器错误500响应。我迷失的部分是当我附加调试器并逐步执行代码时,操作似乎成功完成,因此似乎发生了某些事情在动作方法运行后导致500但我不# 39;知道在动作方法之后运行的任何代码。
这是.js ajax,动作方法及其响应:
_paymentPlanXhr = $.ajax({
type: "POST",
url: $("#_Booking_UpdatePaymentUrl").val(),
data: "purchaseMem="+ purchaseMem +"&sid=" + selectedStudentID,
cache: false,
dataType: "json",
timeout: 120000,
success: function (response) {
...
},
error: function (jqXHR, textStatus, errorThrow) {
_paymentPlanXhr = null;
$loadingDiv.hide();
_pendingPaymentPlanUpdate = false;
//If this was really an error, not the result of our code cancelling the request
if (textStatus != "abort")
$("#divPaymentLoadError").show();
}
});
行动方法:
[HttpPost]
public ContentResult Booking_UpdatePayment(PsnBookingPage currentPage, bool purchaseMem, Guid sid)
{
AjaxResponse result = new AjaxResponse();
BookingViewModel bookingVM = new BookingViewModel();
try
{
//Code for building the vm omitted for brevity since it succeeds.
result.Content = this.RenderPartialView(_paymentViewUrl, viewModel, true);
}
catch (Exception ex)
{
viewModel.AbortView = true;
viewModel.AbortMessage = "We're sorry! Something went wrong and we were unable to load the view.";
}
return result.ToContentResult();
}
result.ToContentResult:
{"HasError":false,"ErrorMessage":null,"Content":" <div id=\"divSelectDate\"><div class=\"data-price\">Due Today: $20.00</div><div class=\"data-price\">Due on Event Date: $0.00</div></div>","Data":null}
我不知道它是否是一个因素,但这是一个基于EPiServer的网站。我怎样才能找到500的来源?
编辑:
也许这与EPiServer有关,因为即使我关闭了自定义错误,我得到的500响应也有以下代替黄色asp.net错误屏幕:
<html>
<head>
<meta name="robots" content="noindex,nofollow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>
Page could not be loaded
</title>
<style type="text/css">
body{font-size:65%;color:black;background-color:White;}
form{font-size:1.2em;}
body,table{font-family:Verdana;font-weight:normal;}
h1{color: gray;font-size: 1.4em;font-family:Verdana;margin:0.5em 0 0 0;}
h2{font-size:1.2em;font-weight:bold;}
h3{display: inline;font-weight:bold;font-size: 1.0em;}
.ExceptionInfo{margin:0.6em 0 0.6em 0.2em;}
.StackTrace{font-family:"Lucida Console";}
th{font-size: 0.8em;text-align:left;white-space: nowrap;}
td{font-size: 0.7em;}
.DetailedHeader{font-weight:bold;border: 1px solid black;padding:4px;text-align:center;}
.ReportForm{font-family:Verdana;font-weight:normal;font-size: 1.0em;color:black;}
.SubmitButton{font-family:Verdana;font-weight:normal;font-size: 1.0em;color:black;}
</style>
<script type="text/javascript">
<!--
function onNavigate(newPageLink)
{
return -1;
}
function onCommand(newCommand)
{
return -1;
}
// -->
</script>
</head><body>
<h1 class="Title">
Page could not be loaded
</h1><p style="width:40em;">The link you specified does not work. This may either be the result of temporary maintenance or an incorrect link.
</p></body></html>
我认为这是一个chrome页面,但另一个帖子暗示它是一个EPiServer生成的页面。
答案 0 :(得分:4)
您正在web.config(或episerver.config)的episerver部分的applicationSettings元素中查找globalErrorHandling属性。
如果您正在使用EPiServer 7或更早版本,它也可能位于网站元素上。