在开发服务器上ASP.Net MVC 3.0“执行子请求错误”但在本地计算机上正常工作

时间:2011-10-05 15:45:16

标签: asp.net-mvc deployment

这是我的堆栈跟踪


    [NullReferenceException: Object reference not set to an instance of an object.]
       HRORx.Controllers.LeftNavLinksController.LeftNavServices() in C:\Common\PRO\HRORx\Controllers\LeftNavLinksController.cs:30
       lambda_method(Closure , ControllerBase , Object[] ) +78
       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +263
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +38
       System.Web.Mvc.c__DisplayClass15.b__12() +128
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +826410
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825632
       System.Web.Mvc.Controller.ExecuteCore() +159
       System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
       System.Web.Mvc.c__DisplayClassb.b__5() +62
       System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
       System.Web.Mvc.c__DisplayClasse.b__d() +54
       System.Web.Mvc.c__DisplayClass4.b__3() +15
       System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41
       System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1443

    [HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
       System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2515
       System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +242
       System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +94
       System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +834
       System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +123
       ASP._Page_Views_Shared__LeftNavLinks_cshtml.Execute() in c:\Server\Web\rx\Views\Shared\_LeftNavLinks.cshtml:2
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
       System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173
       System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +158
       ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:\Server\Web\rx\Views\Shared\_Layout.cshtml:54
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
       System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173
       System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
       System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +234
       System.Web.WebPages.WebPageBase.PopContext() +222
       System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384
       System.Web.Mvc.c__DisplayClass1c.b__19() +33
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +825604
       System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
       System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825632
       System.Web.Mvc.Controller.ExecuteCore() +159
       System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
       System.Web.Mvc.c__DisplayClassb.b__5() +62
       System.Web.Mvc.Async.c__DisplayClass1.b__0() +20
       System.Web.Mvc.c__DisplayClasse.b__d() +54
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

我可以在本地机器上构建和运行应用程序,但是当我将它部署到开发服务器时,我收到此错误。
任何帮助将不胜感激。
谢谢

1 个答案:

答案 0 :(得分:0)

堆栈跟踪抱怨C:\ Common \ PRO \ HRORx \ Controllers \ LeftNavLinksController.cs的第30行。你有没有检查过该行的所有内容?是否可以发布该线上或周围发生的事情?

另外,你在那种控制器方法中使用LINQ吗?我遇到了类似的错误,我返回一个包含表中空值的列表。我的本地数据库(没有空值)和生产环境(有空值)之间的数据不同。