I have some code in my ASP.NET app in C# that's in the Global.asax.cs
code file. In the Application_Start
, Session_Start
and Application_Begin Request
I have set some breakpoints. However none of these are ever hit. I'm working on my local machine with VS8.
Here's what I've tried:
Global.asax
Upon trying my after these, the breakpoints will not hit.
Any ideas why this might be?
I've run into this same problem. I'm assuming you are using your local IIS instead of the VS Development Server. If this is the case, you won't be able to debug/Step through this code in the Global.asax.cs file because by the time the debugger has attached, this code has already executed in IIS. However, if you use the Dev server, you have the ability to get to this code as the debugger will already be attached.
So, Change the server in your project properties to use the Visual Studio Development Server.
This can be found by right clicking your project within Visual Studio > Project Properties
> Web tab
> Use Visual Studio Development Server
.
What helped me was to add:
System.Diagnostics.Debugger.Break();
to that Application_Start()
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With