[Serializable]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_Exception))]
[ComVisible(true)]
public class Exception : ISerializable, _Exception
[Serializable]
[ComVisible(true)]
public class StackTrace
把本地的Session模式也改成SQLServer并Debug,结果发现问题了:new StackTrace(exp, true)根本没有生成正确的StackTrace,所以下面的堆栈追踪也就没有了下文,这是为什么,笔者也不解,希望知道的童鞋能告知。算了此路不通换一种方式,直接使用Exception.StackTrace,使用Exception属性总该可以了吧,果然获得了我想要的东西。再次发布IIS,问题又来了,这次虽然错误消息"进步"了,类似
at Web.Pages.ContractMgt.ContractMgt.ContractInfo.btnRefresh_Click(Object sender, EventArgs e)
但是为什么后面的没了,不是应该是如下的吗?
at Web.Pages.ContractMgt.ContractMgt.ContractInfo.btnRefresh_Click(Object sender, EventArgs e) in D:\newWorkSpace\src\projectlms\Web\Pages\ContractMgt\ContractMgt\ContractInfo.aspx.cs:line 860
对文件名、行号,这也是我们需要的啊。 三、问题解决
没办法,Google吧,在查阅了一些资料后,偶发现了原因,原来是在发布到IIS的时候我把编译生成的PDB文件给删了,此奥!PDB这个文件主要会存储对应模块(dll或者exe)内部的所有符号,以及符号对应的地址、文件名和行号。原来如此。那赶紧加回去吧,再次运行,还是不行,靠,奔溃了,继续Google,网上有人说是web.config的这个配置会影响,直接删除再试
1. 是否会影响性能
http://www.wintellect.com/blogs/jrobbins/do-PDB-files-affect-performance (Do PDB Files Affect Performance?)
The executive summary answer: no, generating PDB files will have no impact on performance whatsoever. As for references that I can point you too, I haven't found any on the web that answer the exact question so let me take both .NET and native development in turn.
http://stackoverflow.com/questions/1270986/do-pdbs-slow-down-a-release-application (Do .pdbs slow down a release application?)
http://developer.iyunv.com/art/201306/397712.htm (.NET PDB文件到底是什么?)
对于.NET应用程序来说,生成PDB文件不会影响编译器的优化,所以也完全不会影响应用的性能
总结:不会影响性能,只会对于生成的程序集中的一个DebuggableAttribute的属性产生影响
2. 是否会影响安全
http://stackoverflow.com/questions/1307482/whats-the-risk-of-deploying-debug-symbols-pdb-file-in-a-production-environmen (What's the risk of deploying debug symbols (pdb file) in a production environment?)
http://stackoverflow.com/questions/933883/are-there-any-security-issues-leaving-the-pdb-debug-files-on-the-live-servers
貌似也不会影响安全