MVC路由404错误

时间:2013-10-09 16:46:24

标签: asp.net-mvc asp.net-mvc-4

我有一个.Net 4.0 MVC 4.0项目。我在日志表中多次跟踪两个错误。

  1. 404_System.Web.HttpException (0x80004005): The controller for path '/Scripts/jquery.validate.unobtrusive' was not found or does not implement IController.
  2. 404_System.Web.HttpException (0x80004005): The controller for path '/UpdateAccrual' was not found or does not implement IController.
  3. 以下是我的Global.Asax文件。

    protected void Application_Error(object sender, EventArgs e)
            {
                  var error = Server.GetLastError();
                  RouteData routeData = new RouteData();
                  routeData.Values.Add("controller", "Error");
                  routeData.Values.Add("action", "Index");
                  string logDescription = Convert.ToString(error);
                  var errorCode = (error is HttpException) ? (error as HttpException).GetHttpCode() : 0;
                  if (errorCode != 0)
                  {
                      logDescription = errorCode + "_"+logDescription;
                  }
                  ErrorLogBL.InsertLog(1, 1, UIConstants.LogName, logDescription, AppContext.CurrentUser.EffectiveUserID);
                  IController errorController = new ErrorController();
                  errorController.Execute(new RequestContext(new HttpContextWrapper(Context), routeData));
                  Response.End();
    
            }
    

    注意:有一个UpdateAccrual控制器。

    注意:我不介意不引人注意的错误。但UpdateAccrual控制器导致系统导航到错误视图。

    问题

    1. 是否因滥用Response.End()
    2. 而导致
    3. 或是由于routing
    4. 中的任何问题

0 个答案:

没有答案