无法绑定零引用的运行时

时间:2012-04-29 04:38:11

标签: c# asp.net-mvc

我自己得到的并不是一个已知的bug,这段代码在另一个动作中通常可以正常工作

Unable to bind the runtime of the zero reference
  Description: An unhandled exception occurred during the execution of the current web request. Examine the stack trace for more information about this error and where it originated in the code.

  Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Unable to bind the runtime of the zero reference

Source Error:

Line 169:@for (int i = 1; i < 10; i++)
Line 170:{
Line 171:    <span>@Ajax.ActionLink((i * 5).ToString(), "Start", new { cost = (i * 5), gameId = Model.IdGame }, AjaxStart)</span> 
Line 172:}
Line 173:
  

[RuntimeBinderException:Неудаетсявыполнитьпривязкиисполняющей   средыпонулевойссылке] CallSite.Target(Closure,CallSite,   对象)+66
  System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site,T0   arg0)+438 ASP._Page_Views_Kamikaze2_TestGamePlay_cshtml.Execute()   在c:\ Users \ User \ Documents \ Visual Studio中   2010 \项目\ Igrok56 \网络\查看\ Kamikaze2 \ TestGamePlay.cshtml:171个
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy()+272
  System.Web.Mvc.WebViewPage.ExecutePageHierarchy()+67
  System.Web.WebPages.StartPage.RunPage()+58
  System.Web.WebPages.StartPage.ExecutePageHierarchy()+94
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext   pageContext,TextWriter writer,WebPageRenderingBase startPage)+172
  System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,   TextWriter writer,Object instance)+574
  System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext   viewContext,TextWriter writer)+360
  System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)   +409 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext   controllerContext,ActionResult actionResult)+39
  System.Web.Mvc&LT;&GT; C_ DisplayClass1c.b _19()   +60 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter   filter,ResultExecutingContext preContext,Func 1 continuation) +391
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +61 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)+391
  System.Web.Mvc&LT;&GT; C_ DisplayClass1e.b _1b()   +61 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext   controllerContext,IList 1 filters, ActionResult actionResult) +285
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830
System.Web.Mvc.Controller.ExecuteCore() +136
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +232 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +68
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44
System.Web.Mvc.Async.<>c__DisplayClass8
1.b__7(IAsyncResult   )+42 System.Web.Mvc.Async.WrappedAsyncResult`1.End()+ 141 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,   对象标签)+54
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,   对象标签)+40
  System.Web.Mvc。&lt;&gt; c
_DisplayClasse.b_ d()+61
  System.Web.Mvc.SecurityUtil.b
_0(动作f)+31   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)   +56 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+110
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult的   结果)+38
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   +8967757 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+184

1 个答案:

答案 0 :(得分:1)

由于Model为null

,会发生此错误