azure webrole Global.Application_Start is never called
application-start, azure, azure-web-roles
Solution
As SMARX stated Applicaton_start() is always called however with your Web Role if you have full IIS role then VS2010 debugger does not hit Application_start(). I am writing the detail below on how you can hit BP at Application_Start() in Global.asax.cs:
First you can write Debugger.Break() code in your Application_Start() as below:
Now please open your Role Properties > Web and select
- Use Visual Studio Development Server settings (I have chosen as shown in image below)
- Use Local IIS Web Server
Now debug your application and you will see a message as below to debug W3WP.EXE process
Select Debug option above and then you will see BS JIT Debugger Windows as below:
Once you accept VS JIT debugger launch process, you will see the PB hit in your Applicaton_start() as below:
That's it!!
Problem
I created a simple ASP.NET project and then added cloud deployment descriptor using Visual Studio. Once I do that, Application_Start() method in global.asax file never gets called. In my project, I do lot of initialization such as loading web.config file, loading connection strings, initiailizing cache, etc. I can not put all of them into WebRole.OnStart() method. Is there any special configuration required to have Application_Start() method in Global class invoked? Thanks, Prasanna