Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug the method I have set up using PreApplicationStartMethodAttribute assembly attribute while running on IIS 7.5?

I have declared the PreApplicationStartMethodAttribute on the assembly level like this:

[assembly: PreApplicationStartMethod(typeof(MyApp.Global), "InitializeApplication")]

See this explanation for more details on that.

Here's the declaration of InitializeApplication:

public class Global : HttpApplication
{
    public static void InitializeApplication()
    {
        // Initialization code goes here...
    }
}

I am running my application on a local IIS 7.5 instance and I want to debug my InitializeApplication method. I have set a break point on it but it doesn't get hit.

I figure that the code is executed when the Application Pool starts, which to my knowledge is before the point when I hit F5 in Visual Studio.

I have tried to attach the debugger to any IIS related process I could find but to no avail.

I also realize that I can debug using Cassini but I need to fix an IIS related issue here.

So, the question is: how can I debug the PreApplicationStartMethodAttribute designated method?

like image 210
Sandor Drieënhuizen Avatar asked Oct 24 '22 11:10

Sandor Drieënhuizen


1 Answers

Try to use IIS Express locally, probably it will be easier to attach debugger to it's process.

like image 148
abatishchev Avatar answered Nov 01 '22 10:11

abatishchev