正显示出异常堆栈跟踪中释放组件或仅有一个DEBUG有用的.dll [英] Is showing the Exception StackTrace useful in a RELEASE assembly or only a DEBUG .dll

查看:146
本文介绍了正显示出异常堆栈跟踪中释放组件或仅有一个DEBUG有用的.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去了一些方法来提高错误我的web服务处理 - 尤其是,显示堆栈跟踪如下例所示:

I've gone to some lengths to improve the error handling in my webservice - in particular, showing the StackTrace as in this example:

catch (Exception ex)
        {
            EventLog log = new EventLog();
            log.Source = g_EventSource;
            StringBuilder msg = new StringBuilder("Exception in UpdateRecord method has been logged:");
            msg.Append(Environment.NewLine);
            msg.Append("passedURL="); msg.Append(passedURL);
            msg.Append(Environment.NewLine);
            msg.Append(ex.Message);
            msg.Append(Environment.NewLine); 
            msg.Append(ex.Source);
            msg.Append(Environment.NewLine);
            msg.Append(ex.StackTrace);
            log.WriteEntry(msg.ToString(), EventLogEntryType.Error, 100);
            return msg.ToString();
        }

我的问题是当我发表我的web服务有它编译成发布,而不是DEBUG会发生什么?我只公布.dll和web.config中(无源)现在当我编译在调试模式,但是当一个错误在我的机器记录的堆栈跟踪点回文件(S)的行号,如:

My question is what will happen when I publish my webservice having compiled it as RELEASE instead of DEBUG? I only publish the .dll and the web.config (no source) now when I compile in DEBUG mode but when an error is logged the StackTrace points back to line numbers of file(s) in my development machine like:

C:\Documents and Settings\johna\My Documents\Visual Studio 2008\Projects\   etc.

在短,会释放模式DLL仍显示上述那种堆栈跟踪?我觉得会,但不知道;因为我们prepare一动到部署的另一个层面我的系统管理员已经提出了这个问题。

In short, will a RELEASE mode DLL still show the above sort of stack trace? I think it will but not sure; my system administrator has raised this question as we prepare for a move into another level of deployment.

推荐答案

您可以在堆栈跟踪信息行numbrers,但你需要包括.PDB文件。没有问题,即使是在释放模式。

You can have line numbrers in Stack Trace messages but you need to include .PDB files. No problems even in release mode.

这篇关于正显示出异常堆栈跟踪中释放组件或仅有一个DEBUG有用的.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆