我在生产中使用Umbraco构建应用程序已经有一个月了,没有问题,但是今天,大多数Razor脚本宏都抛出了一个神秘的异常错误。
错误是:
Error loading Razor Script AnnouncementSummary.cshtml
The type initializer for 'Examine.ExamineManager' threw 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内部异常
Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12)这个错误只发生在生产环境上,我在网络上做了很多调查,没有任何可行的解决方案。我尝试获得最新版本的检查,并尝试将App凭据更改为Network,并授予它对c:\Windows\Temp的完全访问权。这两项建议都没有奏效。
这里是我的Razor脚本之一,它生成了错误:
@{ 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")在调用时抛出异常。
有很大的压力,我要纠正这个错误,因此,任何帮助将不胜感激。提前谢谢。
发布于 2012-03-13 12:41:06
当我更新了Umbraco中的一些检查DLL时,出现了这个错误,但并不是全部。我解决它的方法是:
从http://examine.codeplex.com/下载最新版本的检查
Examine.dll、Lucene.Net.dll和UmbracoExamine.dll复制到/bin目录App_Data\TEMP\ExamineIndexes目录中的所有现有索引。这将是re-created.不能说它会对你有效,但值得为任何有类似错误的人尝试。
如果仍然有任何错误,请检查umbracoLog表以确定它们是什么。
发布于 2012-02-01 13:07:29
当临时文件夹的权限设置不正确时,就会发生这种情况。
你确定你在使用正确的应用程序池吗?
应该是:名称: ASP.NET v4.0标识: NetworkService
确保网络服务具有对临时文件夹的写权限。
https://stackoverflow.com/questions/9085100
复制相似问题