Steve
Steve

Reputation: 5952

Flakey debug behavior in application start, global.asax

Not using Cassini, but IIS7 to run an ASP.NET app.

The debug behavior is flakey. Sometimes it works, sometimes it doesn't. I was able to step into the application start event in global.asax but sometimes I can't.

Sometimes VS2008 opens the published global.asax so I have two instances of global.asax opened in VS, the source and the published.

I reset the AppDomain and IIS and I can't put my finger on why this is happening. Any clues?

To add, while it won't go into application start, I have an OnChangeEventHandler event - it does step into the event handler.

Upvotes: 1

Views: 1158

Answers (2)

user4055351
user4055351

Reputation: 1

make a change in the web.config, the application pool will recycle and the global.asax code will be loaded, the debugger should still be attached

Upvotes: 0

MOZILLA
MOZILLA

Reputation: 5980

Visual Studio doesn't connect to w3wp.exe soon enough to handle breakpoints in Application_Start for IIS7-hosted applications. To debug, use the following line to call debugger explicitly,

System.Diagnostics.Debugger.Launch();

and choose to launch a new instance of Visual Studio.

Upvotes: 6

Related Questions