Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# MVC
Hi All,
 
I am getting below exception in my event Log. I have no steps, why this occurs, Any help is appreciated.
 
Exception: System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Sequence contains no matching element   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)   at ASP.views_guests_index_aspx.__RenderContent1(HtmlTextWriter __w, Control parameterContainer)   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)   at ASP.shared_bookingprocess_master.__RenderContentBody(HtmlTextWriter __w, Control parameterContainer)   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)   at ASP.shared_bookingengine_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)   at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.HandleError(Exception e)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest()   at System.Web.UI.Page.ProcessRequest(HttpContext context)   at ASP.views_guests_index_aspx.ProcessRequest(HttpContext context)   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.b__3()   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)   at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.b__19()   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
Posted 3-Aug-12 2:12am
PratSol209
Edited 3-Aug-12 2:14am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I'm going to post a meta-solution again. Make sure you have a sufficient grounding in the technology before you use it; you may need to step back and take a slower paced C# course. Reading and interpreting exception messages is an important part of being a good developer, and this one is fairly clear, so you shouldn't need to ask us about it.
 
This one says "System.InvalidOperationException: Sequence contains no matching element". That's pretty clear: you tried to call First on a list which didn't contain any items that matched the search criteria.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Seems like you are using LINQ in your code. First() will throw an exception if it can't find any matching elements. See if following post helps you:
 
http://stackoverflow.com/questions/3994336/sequence-contains-no-matching-element[^]
http://stackoverflow.com/questions/9907963/linq-query-issue-sequence-contains-no-elements[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 278
1 Maciej Los 205
2 DamithSL 193
3 Nguyen.H.H.Dang 190
4 arvind mepani 187


Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 3 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid