首页 > 解决方案 > 2SXC - SearchIndexException:搜索:索引模块时出错

问题描述

我收到了可怕的 DNN 错误“发生了意外错误”,并带有返回站点的链接。这里没有显示其他信息,所以我检查了下面的日志\Portals\_default\Logs\,发现:

2019-09-26 10:15:02.052-05:00 [XXXXXX][D:4][T:84][ERROR] DotNetNuke.Services.Exceptions.Exceptions - ToSic.SexyContent.Search.SearchIndexException: Search: Error while indexing module 450 on tab 44, portal 0 ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at ToSic.Eav.Security.Permissions.PermissionCheckBase.DoesPermissionAllow(IEntity permissionEntity, Char[] desiredActionCode) in C:\Projects\eav-server\ToSic.Eav.Core\Security\Permissions\PermissionCheckBase.cs:line 119
    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
    at ToSic.SexyContent.SxcInstance.get_UserMayEdit() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\SxcInstance_Render.cs:line 17
    at ToSic.SexyContent.ContentBlocks.ModuleContentBlock..ctor(IInstanceInfo instanceInfo, Log parentLog, ITenant tenant, IEnumerable`1 overrideParams) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\ContentBlocks\ModuleContentBlock.cs:line 66
    at ToSic.SexyContent.Environment.Dnn7.Search.SearchController.GetModifiedSearchDocuments(IInstanceInfo instance, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Search\SearchController.cs:line 53
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Environment\Dnn7\DnnBusinessController.cs:line 98
    --- End of inner exception stack trace ---
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Environment\Dnn7\DnnBusinessController.cs:line 102
    at DotNetNuke.Services.Search.ModuleIndexer.IndexSearchDocuments(Int32 portalId, ScheduleHistoryItem schedule, DateTime startDateLocal, Action`1 indexer)
2019-09-26 10:15:02.069-05:00 [XXXXXX][D:4][T:84][ERROR] DotNetNuke.Services.Exceptions.Exceptions - ToSic.SexyContent.Search.SearchIndexException: Search: Error while indexing module 451 on tab 20, portal 0 ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at ToSic.Eav.Security.Permissions.PermissionCheckBase.DoesPermissionAllow(IEntity permissionEntity, Char[] desiredActionCode) in C:\Projects\eav-server\ToSic.Eav.Core\Security\Permissions\PermissionCheckBase.cs:line 119
    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
    at ToSic.SexyContent.SxcInstance.get_UserMayEdit() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\SxcInstance_Render.cs:line 17
    at ToSic.SexyContent.ContentBlocks.ModuleContentBlock..ctor(IInstanceInfo instanceInfo, Log parentLog, ITenant tenant, IEnumerable`1 overrideParams) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\ContentBlocks\ModuleContentBlock.cs:line 66
    at ToSic.SexyContent.Environment.Dnn7.Search.SearchController.GetModifiedSearchDocuments(IInstanceInfo instance, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Search\SearchController.cs:line 53
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Environment\Dnn7\DnnBusinessController.cs:line 98
    --- End of inner exception stack trace ---
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2sxc Dnn\Environment\Dnn7\DnnBusinessController.cs:line 102
    at DotNetNuke.Services.Search.ModuleIndexer.IndexSearchDocuments(Int32 portalId, ScheduleHistoryItem schedule, DateTime startDateLocal, Action`1 indexer)

不幸的是,自从我在 8 月初进行的演示中创建了一个示例帖子以来,我根本没有接触过该站点,这意味着我不知道我做了什么导致错误。当时我没有收到任何错误消息,在得到大佬的批准后,我将注意力转移到其他项目上,不记得做过任何平常的事情或遇到任何错误。但我今天尝试访问该站点,我收到了与 2SXC 相关的这些错误。

这些错误是什么意思?如何解决问题以恢复我的网站?

更新:我正在使用新闻应用程序 03.01.04 运行 DNN 9.1.1 和 2SXC 09.32.01

更新 2:我也注意到了这个错误:

2019-09-27 11:17:08.567-05:00 [XXXXXX][D:2][T:10][ERROR] DotNetNuke.Services.Exceptions.Exceptions - DotNetNuke.Services.Exceptions.PageLoadException: Unhandled error loading page. ---> System.Web.HttpParseException: The file '/DesktopModules/DDRMenu/Menu.ascx' does not exist. ---> System.Web.HttpParseException: The file '/DesktopModules/DDRMenu/Menu.ascx' does not exist. ---> System.Web.HttpException: The file '/DesktopModules/DDRMenu/Menu.ascx' does not exist.
    at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
    at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
    at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
    at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath)
    at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry)
    at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive)
    at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
    --- End of inner exception stack trace ---
    at System.Web.UI.TemplateParser.ProcessException(Exception ex)
    at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
    at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
    --- End of inner exception stack trace ---
    at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
    at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
    at System.Web.UI.TemplateParser.ParseInternal()
    at System.Web.UI.TemplateParser.Parse()
    at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
    at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
    at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
    at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
    at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
    at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
    at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
    at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc)
    at DotNetNuke.UI.Skins.Skin.LoadSkin(PageBase page, String skinPath)
    --- End of inner exception stack trace ---

标签: dotnetnuke2sxc

解决方案


我的问题实际上与 2SXC 无关。在关于原始问题的更新 2 中,我提到我还注意到一个错误说:

System.Web.HttpParseException: The file '/DesktopModules/DDRMenu/Menu.ascx' does not exist.

这显然是 Visual Studio 中 DNN 模块开发的常见问题。来自HemIT 博客

这个虚拟目录是从哪里来的?在我的开发环境中,它来自以下事实:

  • 我们使用的是 SVN,我倾向于检查模块并在我的 IIS 网站之外编译它们
  • 我正在使用著名的 christoc 模板进行模块开发(不要误会,它很棒!它只是在背后做我们可能无法预见的事情)。事实上,如果我查看我的项目文件:

视觉工作室图像

真正的罪魁祸首是 Visual Studio!

当您检查模块时,如果您在 IIS 上配置了站点,项目将正常打开。但是,当您编译时,如果您不在 IIS 网站之外,则会创建一个虚拟目录“desktopmodule”,并隐藏“DesktopModules”文件夹。

因此 DNN 无法再找到 DDRMenu 模块,因此它失败了。

解决方案非常简单。进入 IIS 并删除标记为“desktopmodules”的虚拟目录:

删除虚拟目录


推荐阅读