简体   繁体   English

如何阅读asp.net错误消息

[英]How to read asp.net error messages

I'd like to get to the bottom of something that has been plagueing me for some time. 我想弄清困扰我一段时间的东西。 How the hell does a person read an ASP.net error message like this: 一个人怎么会这样读取ASP.net错误消息:

Error: is currently unavailable. 错误:当前不可用。 DotNetNuke.Services.Exceptions.ModuleLoadException: The server tag is not well formed. DotNetNuke.Services.Exceptions.ModuleLoadException:服务器标记格式不正确。 ---> System.Web.HttpParseException: The server tag is not well formed. ---> System.Web.HttpParseException:服务器标记格式不正确。 ---> System.Web.HttpException: The server tag is not well formed. ---> System.Web.HttpException:服务器标记格式不正确。 at System.Web.UI.TemplateParser.ProcessError(String message) 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.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(VirtualPat 在System.Web.UI.TemplateParser.ProcessError(String message)在System.Web.UI.TemplateParser.ParseStringInternal(String text,Encoding fileEncoding)在System.Web.UI.TemplateParser.ParseString(String text,VirtualPath virtualPath,Encoding fileEncoding )-内部异常堆栈跟踪的结尾--在System.Web.UI.TemplateParser.ParseString(String文本,VirtualPath virtualPath,编码fileEncoding)在System.Web.UI.TemplateParser.ParseFile(String physicalPath,VirtualPath virtualPath)在System.Web.UI.TemplateParser.Parse()在System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()在System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)在System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()在System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPat)的System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)处的System.Web.Compilation.BuildProvidersCompiler.PerformBuild() h 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.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace --- h virtualPath,布尔值noBuild,布尔值allowCrossApp,布尔值allowBuildInPrecompile,布尔值throwIfNotFound,布尔值sureIsUpToDate)位于System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext上下文,VirtualPath虚拟路径,布尔值NoBuild,布尔值allowCrossApp,布尔值allowBuildInPreCompile,在System.Web.UI.TemplateControl.LoadControl(位于DotNetNuke.UI.ControlUtilities。 DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl()处的LoadControl [T](TemplateControl containerControl,String ControlSrc)-内部异常堆栈跟踪的结尾-

This is DNN , but this happens from time to time in other .net applications like Sitefinity too and although I can see what the error is, it doesn't tell me where to start looking. 这是DNN ,但这在其他.net应用程序(例如Sitefinity)中时常发生 ,尽管我可以看到错误所在,但它并没有告诉我从哪里开始寻找。

Thanks :) 谢谢 :)

The actual exception is on the first line. 实际的例外是第一行。 'DotNetNuke.Services.Exceptions.ModuleLoadException' followed by the exception message. “ DotNetNuke.Services.Exceptions.ModuleLoadException”,后跟异常消息。

The rest of the text is mostly the stack trace. 其余文本大部分是堆栈跟踪。 This is useful if say the method throwing the error is called from several places, and you want to know which one. 如果说抛出错误的方法是从多个地方调用的,并且您想知道哪个地方,这将很有用。 The further you read in the trace, the higher up you get in the call chain. 您在跟踪中阅读的越深,您在呼叫链中的了解就越高。 So TemplateParser.ProcessError was called by ParseStringInternal, which was called by ParseString, and so on. 因此,ParseStringInternal调用了TemplateParser.ProcessError,ParseString调用了模板等等。

Now to the problem at hand, it says the server tag is not well formed. 现在要解决的问题是,服务器标签的格式不正确。 I'm not that familiar with DNN, but a quick google on the message and exception name finds this: http://www.dotnetnuke.com/Resources/Blogs/EntryId/1496/The-server-tag-is-not-well-formed-oh-my.aspx 我对DNN不太熟悉,但是快速搜索消息和异常名称就可以找到它: http : //www.dotnetnuke.com/Resources/Blogs/EntryId/1496/The-server-tag-is-not-格式正确的哦.aspx

Which, in case the article is ever moved, contains this solution: 如果文章曾被移动过,其中包含以下解决方案:

This error is caused by an invalid characted located in the file called EditEntry.ascx. 此错误是由位于EditEntry.ascx文件中的无效字符引起的。 This character has an accent in it causing the crash. 此字符带有重音,导致崩溃。 For full disclosure, this (now) invalid character has been in the code for quite a while, probably since its first public release. 为了完全公开,这个(现在)无效字符已经存在了很长一段时间,可能是自第一次公开发布以来。

Open DesktopModules\\Blog\\EditEntry.ascx Go to line 21 Look for the string matching "ResourcêKey " (notice the funky "e") Replace "ê" with "e" Save and upload This fix will get you up and running once again. 打开DesktopModules \\ Blog \\ EditEntry.ascx转到第21行,查找与“ResourcêKey”匹配的字符串(注意时髦的“ e”),将“ê”替换为“ e”。保存并上传此修复程序将使您重新启动并运行。

A nice trick is explained in this article here - 这篇文章在这里介绍了一个不错的技巧-

Click link read full article 点击链接阅读全文

It tells about updating the global.asax file to the line number. 它告诉您如何将global.asax文件更新为行号。

void Application_Error(object sender, EventArgs e)
{
   // Code that runs when an unhandled error occurs
   Exception ex = Server.GetLastError();

   // get line number from ASPX parse error
   System.Web.HttpParseException httpParseEx = ex as System.Web.HttpParseException;

   if (httpParseEx != null)
   {
       String lineNumber = "Line number: " + httpParseEx.Line;
   }
} 

That's called a callstack . 这就是所谓的callstack Many debuggers or programming environments will display this when a problem happens. 发生问题时,许多调试器或编程环境都会显示此信息。 Usually, what you want to do is start at the top of the callstack and identify which are "system" calls and which are the calls more likely to be the source of the problem. 通常,您想要做的是从调用堆栈的顶部开始,确定哪些是“系统”调用,哪些是更有可能成为问题根源的调用。 In this case: 在这种情况下:

DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl()上的DotNetNuke.UI.ControlUtilities.LoadControl [T](TemplateControl containerControl,String ControlSrc)

Is the most likely source of the problem. 是问题的最可能根源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM