I had an application built using Umbraco in production for about a month without any problems, but today the mysterious exception error is caused by most of my Razor Script macros.
Error:
Error loading Razor Script AnnouncementSummary.cshtml The type initializer for 'Examine.ExamineManager' threw an exception.
And exception error details:
An exception
System.TypeInitializationException: The type initializer for 'Examine.ExamineManager' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12) ---> System.MissingMethodException: Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. at UmbracoExamine.UmbracoContentIndexer.Initialize(String name, NameValueCollection config) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) --- End of inner exception stack trace --- at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at Examine.ExamineManager.LoadProviders() at Examine.ExamineManager..cctor() --- End of inner exception stack trace --- at umbraco.MacroEngines.ExamineBackedMedia.GetUmbracoMedia(Int32 id) at umbraco.MacroEngines.DynamicNode.Media(String propertyAlias) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at ASP._Page_macroScripts_AnnouncementSummary_cshtml.Execute() in c:\inetpub\wwwroot\DCASConnect\DCASConnect\macroScripts\AnnouncementSummary.cshtml:line 13
Internal exception
Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12)
This error occurs only in the production environment, and I do a lot on the network without any solutions. I tried to get the latest version of Examine, and also tried changing the App Pool credentials for Network Service and giving it full access to c: \ Windows \ Temp. Both suggestions did not work.
Here is one of my Razor scripts that generate an error:
@{ var numberOfItems = 10; } @foreach (var item in @Model.Descendants("umbAnnouncementPage").Where("Visible").OrderBy("CreateDate desc").Take(numberOfItems)) { var imageUrl = ""; var link = @item.Url; string text = @item.shortDescription; if (@item.HasValue("articleImage")) { item.Media("articleImage"); @*** This is where it fails ***@ imageUrl = "/usercontrols/ImageGen.ashx?image=" + @item.Media("articleImage").UmbracoFile + "&width=120&crop=resize&pad=false&bgcolor=f2f2f2"; } else { imageUrl = "/usercontrols/ImageGen.ashx?image=/media/3115/defaultannouncement.jpg&&width=120&&height=80&&constrain=true&&crop=resize"; } if (@item.HasValue("url")) { link = @item.url; } var lineOfService = ""; foreach (var line in @item.Ancestors("umbLineOfService")) { lineOfService = line.lineOfServiceName; } <div class="clearboth"> <h4 class="announcement underline-dotted"><a href="@link">@item.Title</a></h4> <a class="summaryImageLeft announcementThumbnail" href="@link"><img alt="" src="@imageUrl" alt="@item.Title"/></a> <div class="smaller-text summaryText"> @Library.Truncate(@text, 200) </div> <div class="clearboth overline-dotted"> <a class="small-text floatright" href="@link">Read more...</a> <span class="small-text">@lineOfService</span></div> </div> <br /> }
@ item.Media ("articleImage") throws an exception when called.
I was greatly influenced by the correction of this error, so any help would be appreciated. Thanks in advance.
source share