Ошибка сервера в приложении '/'.

The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.

Описание: Необработанное исключение при выполнении текущего веб-запроса. Изучите трассировку стека для получения дополнительных сведений о данной ошибке и о вызвавшем ее фрагменте кода.

Сведения об исключении: System.InvalidOperationException: The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.

Ошибка источника:


Строка 1:  @{
Строка 2:      var sm = Html.MvcSiteMap();
Строка 3:  }
Строка 4:  

Исходный файл: d:\WebApps\wwwparlam\Areas\Mazhilis\Views\Shared\Blue\_Footer.cshtml    Строка: 2

Трассировка стека:


[InvalidOperationException: The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.]
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +1187
   System.Data.Entity.Internal.InternalContext.Initialize() +26
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +20
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +69
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +59
   System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +64
   Parlam.Data.Infrastructure.RepositoryBase`1.Find(Expression`1 filter, Expression`1[] includeProperties) in C:\Users\karazhan\source\repos\Parlam\Parlam.Data\Infrastructure\RepositoryBase.cs:72
   Parlam.Web.Areas.Mazhilis.SiteMapProviders.<GetDynamicNodeCollection>d__2.MoveNext() in C:\Users\karazhan\source\repos\Parlam\Parlam.Web\Areas\Mazhilis\SiteMapProviders\MazhilisDynamicNodeProvider.cs:0
   MvcSiteMapProvider.Builder.DynamicSiteMapNodeBuilder.BuildDynamicNodes(ISiteMapNode node, String defaultParentKey) +208
   MvcSiteMapProvider.Builder.XmlSiteMapNodeProvider.ProcessXmlNodes(ISiteMapNode parentNode, XElement parentElement, NodesToProcess processFlags, ISiteMapNodeHelper helper) +636
   MvcSiteMapProvider.Builder.XmlSiteMapNodeProvider.LoadSiteMapNodesFromXml(XDocument xml, ISiteMapNodeHelper helper) +194
   MvcSiteMapProvider.Builder.XmlSiteMapNodeProvider.GetSiteMapNodes(ISiteMapNodeHelper helper) +96
   MvcSiteMapProvider.Builder.SiteMapBuilder.LoadSourceNodes(ISiteMap siteMap, String siteMapCacheKey, List`1 sourceNodes) +53
   MvcSiteMapProvider.Builder.SiteMapBuilder.BuildSiteMap(ISiteMap siteMap, ISiteMapNode rootNode) +140
   MvcSiteMapProvider.SiteMap.BuildSiteMap() +65
   MvcSiteMapProvider.LockableSiteMap.BuildSiteMap() +20
   MvcSiteMapProvider.Loader.SiteMapCreator.CreateSiteMap(String siteMapCacheKey) +143
   MvcSiteMapProvider.Caching.LazyLock.Get(Func`1 activator) +109
   MvcSiteMapProvider.Caching.MicroCache`1.GetOrAdd(String key, Func`1 loadFunction, Func`1 getCacheDetailsFunction) +499
   MvcSiteMapProvider.Web.Html.HtmlHelperExtensions.MvcSiteMap(HtmlHelper helper) +60
   ASP._Page_Areas_Mazhilis_Views_Shared_Blue__Footer_cshtml.Execute() in d:\WebApps\wwwparlam\Areas\Mazhilis\Views\Shared\Blue\_Footer.cshtml:2
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +136
   ASP._Page_Areas_Mazhilis_Views_Shared_Blue__Layout_cshtml.Execute() in d:\WebApps\wwwparlam\Areas\Mazhilis\Views\Shared\Blue\_Layout.cshtml:300
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +304
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +88
   System.Web.WebPages.WebPageBase.PopContext() +349
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +31
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +187
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +41
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +648
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131


Информация о версии: Платформа Microsoft .NET Framework, версия:4.0.30319; ASP.NET, версия:4.7.4076.0