Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug startup exceptions with service hosted in IIS?

Tags:

c#

iis

debugging

I have my service running in IIS. I have a non fatal exception occurring and being logged on startup.

How do I attach Visual Studio to IIS so that it also debugs the startup?

I know I can attached visual studio to the w3wp.exe to debug while its running.

like image 577
CathalMF Avatar asked Sep 24 '15 11:09

CathalMF


1 Answers

Add the following to your application's start up code:

System.Diagnostics.Debugger.Break();

When this line is hit, you will be prompted to attach a debugger to the process. See Debugger.Break for more details.

like image 150
Polyfun Avatar answered Oct 31 '22 23:10

Polyfun