Azure webrole Global.Application_Start is never called
I created a simple ASP.NET project and then added a cloud deployment descriptor using Visual Studio. Once I do this, the Application_Start () method in the global.asax file will never be called. In my project, I have a lot of initialization, such as loading the web.config file, loading connection strings, initializing the cache, etc. I cannot put them all in the WebRole.OnStart () method.
Is there any special configuration required to use the Application_Start () method in a global class?
Thanks Prasanna
As SMARX pointed out, Applicaton_start () is always called, however, with your web role, if you have the full IIS role, then the VS2010 debugger does not fall into Application_start (). I write in detail below about how you can push BP on Application_Start () in Global.asax.cs:
First you can write the Debugger.Break () code in your Application_Start (), as shown below:
Now go to Roles Properties> Web and select
- Use the Visual Studio development server settings (I selected as shown in the figure below).
- Use local IIS web server
Now we are debugging your application and you will see a message as shown below to debug the W3WP.EXE process
Select the Debug option above, and then you will see the BS JIT Debugger window, as shown below:
After you accept the VS JIT debugger startup process, you will see PB hit your Applicaton_start (), as shown below:
What is it!