I've had an application built using Umbraco in production for about a month now without problems, but today, a mysterious exception error is being thrown by most of my Razor Script macros.
The error is:
Error loading Razor Script AnnouncementSummary.cshtml
The type initializer for 'Examine.ExamineManager' threw an exception.
And the details of the exception error are:
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
Inner Exception
Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12)
This error is only happening on the production environment and I've been doing a lot of digging around the net without any solutions that work. I've tried getting the latest version of Examine and also tried changing the App Pool credentials to Network Service and granting it full access to c:\Windows\Temp. Both suggestions did not work.
Here is one of my Razor Scripts that's generating the 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 the exception on call.
There's a lot of pressure on me to fix this error, so any assistance would be appreciated. Thanks in advance.
I've had this error when I've updated some of the Examine DLLs in Umbraco, but not all of them. I solved it by:
Downloading the latest version of Examine from http://examine.codeplex.com/
Examine.dll
, Lucene.Net.dll
and UmbracoExamine.dll
to your /bin
directory App_Data\TEMP\ExamineIndexes
directory. These will be re-created.Can't say it will work for you, but worth a try for anyone with similar error.
If you still get any errors check the umbracoLog table to determine what they are.
This is exactly what happens when permissions aren't set correctly for the temp folder.
Are you sure you are using the correct app pool?
It should be: Name: ASP.NET v 4.0 Identity: NetworkService
Make sure that network service has got write permissions to the temp folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With