有些時候DNN中程序出錯的提示沒有指出具體的出錯位置,如果使用斷點跟蹤也不知在何處插入斷點,這樣我們debug完全只能靠猜測,比如如下的出錯提示:
Error: Edit Content is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException:
External component has thrown an exception. ---> System.Web.HttpCompileException: External component has thrown an exception.
at System.Web.Compilation.AssemblyBuilder.Compile()
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)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
at System.Web.UI.TemplateControl.LoadControl(String virtualPath)
at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) in
E:\Development\DotNetNuke\InstallArea\DotNetNuke_04.08.03_Source\Library\Components\Skins\Skin.vb:line 492 --- End of inner exception stack trace ---
使用這個文件就可清楚的看到是哪裡出了問題:
下載 DNNDebug.rar 文件並解壓得到 "DNNDebug.aspx" 文件
把這個文件放在DotNetNuke網站的根目錄裡
然後在浏覽器裡訪問這個文件 (如: http://localhost/Dotnetnuke/DNNDebug.aspx)
輸入加載時出錯的web contol地址(比如: ~/DesktopModules/Feedback/Feedback.ascx)
如果幫你解決的大問題,你可以給作者Nik 發個郵件表示感謝
注意!
網站發布時一定要刪除這個文件!!