2SXC - SearchIndexException:搜索:索引模块时出错

2SXC - SearchIndexException: Search: Error while indexing module

我在网站上收到可怕的 DNN 错误 "An unexpected error has occurred" link 到 return。这里没有显示其他信息,所以我查看了 \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:\Projectssxc-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:\Projectssxc-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:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc Dnn\Search\SearchController.cs:line 53
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc 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:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc 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:\Projectssxc-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:\Projectssxc-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:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc Dnn\Search\SearchController.cs:line 53
    at ToSic.SexyContent.Environment.Dnn7.DnnBusinessController.GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDate) in C:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc 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:\Projectssxc-dnn742\Website\DesktopModules\ToSIC_SexyContentsxc Dnn\Environment\Dnn7\DnnBusinessController.cs:line 102
    at DotNetNuke.Services.Search.ModuleIndexer.IndexSearchDocuments(Int32 portalId, ScheduleHistoryItem schedule, DateTime startDateLocal, Action`1 indexer)

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

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

更新: 我是 运行 DNN 9.1.1 和 2SXC 09.32.01,新闻应用 03.01.04

更新 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 ---

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

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

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

Where does this Virtual Directory come from? In my development environment, it comes from the following facts:

  • we are using SVN, and I tend to checkout the modules and compile them outside of my IIS websites
  • I am using the famous christoc template for module development (don't get me wrong, it's great! It's just doing things behind our back that we might not foresee). Indeed, if I look in my project file:

The real culprit is Visual Studio!

When you are checking your module out, if you have a site configured on IIS, project will open fine. However when you compile, if you are out of an IIS website, a virtual directory "desktopmodule" will get created, and hide the "DesktopModules" folder.

Hence DNN can no longer find the DDRMenu module, hence it is failing.

解决方法非常简单。进入 IIS 并删除标有 "desktopmodules":

的虚拟目录