Cod*_*ike 24 .net asp.net iis web-services
我正在为开发服务器部署ASP.NET和Web服务解决方案到IIS .看起来执行此作业的最后一个人也部署了所有.pdb文件.我问过它,并被告知如果它们留在服务器上,它们"在日志中提供更好的堆栈跟踪信息".
有没有道理呢?我总是将它们留在后面,从不将它们部署到本地机器以外的任何地方.
对于内部开发IIS服务器(不是生产,外部无法访问)是否有理由部署.pdb文件?有什么不好可能发生吗?他们真的提供任何好处吗?
Cod*_*ike 39
我总是认为.pdb文件只被调试器使用.如果运行时总是检查它们是否有调试信息,这应该意味着在抛出异常时执行速度较慢,因为它必须读取.pdb,对吧?
所以我做了一个快速测试:
using System;
using System.Text;
namespace PdbSpeedTest
{
class Program
{
static void Main(string[] args)
{
DateTime start = DateTime.Now;
try
{
Program p = new Program();
p.Looper(0);
}
catch (NotImplementedException e)
{
Console.WriteLine(e.StackTrace);
}
TimeSpan span = DateTime.Now - start;
Console.WriteLine(span.TotalMilliseconds.ToString());
}
internal void Looper(int x)
{
try
{
if (x < 100)
Looper(x + 1);
else
throw new NotImplementedException("blah!");
}
catch (NotImplementedException e)
{
throw new NotImplementedException("blah!", e);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这只是递归100级并引发异常.现在为运行时结果:
作为运行调试构建与在同一文件夹中的.pdb:
C:\Work\PdbSpeedTest\bin\Debug>PdbSpeedTest.exe
at PdbSpeedTest.Program.Looper(Int32 x) in C:\Work\PdbSpeedTest\Program.cs:line 37
at PdbSpeedTest.Program.Main(String[] args) in C:\Work\PdbSpeedTest\Program.cs:line 16
31.2504
Run Code Online (Sandbox Code Playgroud)
在没有 .pdb的情况下作为调试版本运行:
C:\Work\PdbSpeedTest\bin\Debug>PdbSpeedTest.exe
at PdbSpeedTest.Program.Looper(Int32 x)
at PdbSpeedTest.Program.Main(String[] args)
15.6252
Run Code Online (Sandbox Code Playgroud)
使用 .pdb 作为发布版本运行:
C:\Work\PdbSpeedTest\bin\Release>PdbSpeedTest.exe
at PdbSpeedTest.Program.Looper(Int32 x) in C:\Work\PdbSpeedTest\Program.cs:line 37
at PdbSpeedTest.Program.Main(String[] args) in C:\Work\PdbSpeedTest\Program.cs:line 16
31.2504
Run Code Online (Sandbox Code Playgroud)
在没有 .pdb的情况下作为发布版本运行:
C:\Work\PdbSpeedTest\bin\Release>PdbSpeedTest.exe
at PdbSpeedTest.Program.Looper(Int32 x)
at PdbSpeedTest.Program.Main(String[] args)
15.6252
Run Code Online (Sandbox Code Playgroud)
这些是从常规的旧命令提示符运行,而不是在Visual Studio中运行.所以.pdb肯定会添加堆栈跟踪信息,并减慢异常处理速度.很有意思!
| 归档时间: |
|
| 查看次数: |
7239 次 |
| 最近记录: |