'Examine.ExamineManager'的类型初始化程序引发了异常Umbraco

Vya*_*che 5 c# initialization umbraco image-processing

我已经在生产中使用Umbraco构建了大约一个月的应用程序,现在没有任何问题,但是今天,我的大多数Razor Script宏都会抛出一个神秘的异常错误.

错误是:

Error loading Razor Script AnnouncementSummary.cshtml
The type initializer for 'Examine.ExamineManager' threw an exception.
Run Code Online (Sandbox Code Playgroud)


并且异常错误的细节是:

例外

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
Run Code Online (Sandbox Code Playgroud)


内在例外

Method not found: 'Void Examine.Providers.BaseIndexProvider.set_SupportUnpublishedContent(Boolean)'. (C:\inetpub\wwwroot\DCASConnect\DCASConnect\config\ExamineSettings.config line 12)
Run Code Online (Sandbox Code Playgroud)


这个错误只发生在生产环境中,我一直在网上挖掘,而没有任何有效的解决方案.我已尝试获取最新版本的Examine,并尝试将App Pool凭据更改为Network Service并授予其对c:\ Windows\Temp的完全访问权限.这两个建议都没有用.

这是我生成错误的Razor Scripts之一:

@{ 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 />   }
Run Code Online (Sandbox Code Playgroud)


@ item.Media("articleImage")在调用时抛出异常.

我有很多压力来解决这个错误,所以任何帮助都会受到赞赏.提前致谢.

Dan*_*plo 6

当我更新了Umbraco中的一些Examine DLL时,我遇到了这个错误,但并非全部.我通过以下方式解决了

http://examine.codeplex.com/下载最新版本的Examine

  • 复制Examine.dll,Lucene.Net.dllUmbracoExamine.dll你的/ bin目录
  • 删除App_Data\TEMP\ExamineIndexes 目录中的所有现有索引 .这些将被重新创建.
  • 您可能需要重新启动站点并发布(任何)页面以重新启动索引过程

不能说它会对你有用,但对于有类似错误的人来说值得一试.

如果仍然出现任何错误,请检查umbracoLog表以确定它们是什么.