2012-07-30 53 views
0

我有我的可用動作。多的人對這種應用工作,並有機會的按鈕被點擊在同一時間。偶爾我會得到以下異常,我該如何解決這個問題?控制器/找不到動作

異常

System.Web.HttpException: A public action method 'CorrectAsIsControl' was not found on controller 'Intranet.Site.Areas.OngoingProjects.Controllers.PaperSurveyEmailCleanUpController'. 
Generated: Mon, 30 Jul 2012 21:38:49 GMT 

System.Web.HttpException (0x80004005): A public action method 'CorrectAsIsControl' was not found on controller 'Intranet.Site.Areas.OngoingProjects.Controllers.PaperSurveyEmailCleanUpController'. 
    at System.Web.Mvc.Controller.HandleUnknownAction(String actionName) 
    at System.Web.Mvc.AsyncController.<>c__DisplayClass19.<BeginExecuteCore>b__15() 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.AsyncController.EndExecuteCore(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.AsyncController.EndExecute(IAsyncResult asyncResult) 
    at System.Web.Mvc.AsyncController.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) 
    at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__4(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() 
    at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) 
    at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) 
    at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 
    at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

操作:

[HttpPost] 
     [NoCaching] 
     public ActionResult CorrectAsIsControl() 


[HttpPost] 
     [NoCaching] 
     public ActionResult UnreadableControl() 

NoCaching過濾

public partial class NoCaching : ActionFilterAttribute 
    { 
     #region OVERRIDES 


     public override void OnResultExecuting(ResultExecutingContext filterContext) 
     { 
      filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); 
      filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false); 
      filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); 
      filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); 
      filterContext.HttpContext.Response.Cache.SetNoStore(); 

      base.OnResultExecuting(filterContext); 
     } 


     #endregion 
    } 

阿賈克斯後

_performStaticActions: function ($click) { 
     var id = $click.attr("rel"); 
     var link = $click.attr("href"); 
     if (id == "") 
      jMessageError("Unable to find Id, operation aborted!", $click, false, true); 
     else if (link == "") 
      jMessageError("Unable to find action link, operation aborted!", $click, false, true); 
     else { 
      jMessage("Processing request...", $click, true, false); 

      //link = link + "?badEmailId=" + id; 
      $.ajax({ 
       cache: false, 
       url: link, 
       type: Ajax.MethodType.POST, 
       data: { badEmailId: id}, 
       error: function (xhr, ajaxOptions, thrownError) { 
        jMessageError(xhr.responseText, $click, false, true); 
       }, 
       success: function (result) { 
        if (result.IsError) { 
         jMessageError(result.Message, $click, false, true); 
        } else { 
         jMessageOK(result.Message + "<br><br>Picking new item...", $click, false, false); 
         setTimeout('PaperSurveyBadEmailCleanUp._pickNewItem()', 3000); 
        } 
       } 
      }); 
     } 
    } 
+0

愚蠢的問題,但這些操作方法絕對是在一個名爲「PaperSurveyEmailCleanUpController」控制器? – 2012-07-30 23:21:01

+0

是。 :) 它偶爾會,只有在IE8發生。 – 2012-07-31 16:15:03

回答

0

我已經採取了鏈接out aCax屬性在ajax後操作,它似乎工作。我從昨天開始沒有收到任何錯誤。現在我需要重新思考NoCaching屬性。