Asp.net mvc ASP.Net MVC 3 JsonResult重定向错误

Asp.net mvc ASP.Net MVC 3 JsonResult重定向错误,asp.net-mvc,asp.net-mvc-3,Asp.net Mvc,Asp.net Mvc 3,我有一个ASP.NETMVC3应用程序,它使用jQuery.ajax调用发布到服务器端控制器操作,如下所示 客户端jQuery调用: //Page the server $.ajax({ url: '/Home/Call_Abort', type: 'POST', data: "{ 'op_id': '" + ajaxOPID + "', 'statMsg': '" + ajaxSta

我有一个ASP.NETMVC3应用程序,它使用jQuery.ajax调用发布到服务器端控制器操作,如下所示

客户端jQuery调用:

//Page the server
        $.ajax({
                url: '/Home/Call_Abort',
                type: 'POST',
                data: "{ 'op_id': '" + ajaxOPID + "', 'statMsg': '" + ajaxStatMsg + "'}",
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                        window.location.href = data.redirectUrl;
                },
                error: function (xhr, ajaxOptions, thrownError) {
                        alert("Error while paging the server to abort.  Reported error: '" + xhr.responseText + "'.");
                }
        });
服务器控制器操作:

[HttpPost]
public JsonResult Call_Abort(string op_id, string statMsg)
{
    return Json(new
    {
        redirectUrl = Url.Action("Operator_Home", "Home", new { op_id = op_id, status = statMsg }),
        isRedirect = true
    });

}
返回URL应该将用户重定向到不同的视图,即Operator_Home视图。这在我的本地开发PC上工作,按预期路由到Operator_Home View,但是当我在我的开发Web Server 2008上运行它并使用IIS 7进行测试时,我会在上面的.ajax调用中抛出以下404错误页面,作为xhr.responseText结果

似乎正在发生的不是重定向到我在重定向URL中指定的视图,即Operator_Home,而是认为Call_Abort controller操作应该返回Call_Abort视图,因为不存在这样的视图,下面的错误会被抛出。但为什么会在Web服务器上发生这种情况,而不是在运行VisualStudioDev服务器的本地PC上?是否需要对IIS上的应用程序进行一些设置调整,以使其与我的开发机器上的应用程序相同。我对MVC路由的理解不够清楚,不知道为什么会发生这种情况。任何帮助或见解都将不胜感激

更新

很抱歉,在我的工作地点,有几个服务器我正在使用,我引用了错误的web服务器。我运行这个的服务器是带有IIS7的Server2008


该错误原来是tha中的URL存在问题。Ajax调用我修改了URL,如下所示:

//Page the server
var abortURL = window.location.origin + '/myApp/Home/Call_Abort';
        $.ajax({
                url: abortURL,
                type: 'POST',
                data: "{ 'op_id': '" + ajaxOPID + "', 'statMsg': '" + ajaxStatMsg + "'}",
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                        window.location.href = data.redirectUrl;
                },
                error: function (xhr, ajaxOptions, thrownError) {
                        alert("Error while paging the server to abort.  Reported error: '" + xhr.responseText + "'.");
                }
        });

这就解决了这个问题,并允许jQuery完成这篇文章。

我删除了我的答案,因为我肯定没有解决它的根本问题。实际上,我没有将IIS6与MVC一起使用,所以我无法回答我认为的根本原因。感谢Andrew,我实际上犯了一个错误,我的工作中有几个服务器,我引用了错误的服务器。特定的web服务器是运行IIS 7的server 2008。如果您有应用程序错误断点,是否可以在附加到服务器后在服务器上发布实际错误?