What is the difference between Start Debugging and

2019-04-10 08:57发布

问题:

My project loads significantly faster when I attach it to my w3wp.exe IIS worker process, than when I "Start Debugging".

However, the same worker process seems to be processing the same amount of modules/DLLs (w3wp.exe) whether I "Start Debugging" or "Attach to Process".

Why is attaching to a process so much quicker?

回答1:

"Start Debugging" launches a new instance of the executable with the debugger attached right from the beginning, so the overhead of all the needed debugger calls is incurred from launch, whereas "Attach to Process" attaches to a already running process, so until then your process was running without any additional overhead caused by debugging.



回答2:

The code without debugging performs much for faster. When you attach the process the application is already started, pool is started, so you do not perform some heavy operations in debug mode, for example Application_OnStart event and some others.