azure - What's the difference between the webrole onStart() event and Application_Start() global.asax event? -
i'm starting feet wet learning technical details of azure, apologies if silly question.
if create cloud service project in visual studio , add webrole mvc application, within mvc application can see "webrole.cs" file. however, when start mvc application starting point, , later want enable azure, right clicking on project , selecting "add windows azure cloud service project", no webrole.cs created.
so go make things happen on start event of webrole? application_start() event of global.asax file?
if so, what's difference between application_start() in global.asax , onstart() method of webrole?
i've found following post, offers partial explanation: what starts first application_start or webrole's onstart?
so if it's case onstart event of webrole occurs before application_start() in global.asax, happens if want run code on onstart() event in project i've later enabled app azure?
when there's no class extending roleentrypoint
web role will run fine, no code run instead of onstart()
, run()
, onstop()
.
application_start()
unrelated azure , ignored azure runtime, it's piece of asp.net wiring. can have application_start()
unconditionally throwing exception , won't prevent web role getting started, http requests fail.
bear in mind starting sdk 1.3 default mode "iis mode" web role payload containing roleentrypoint
descendant runs in 1 process (waiishost.exe) , asp.net code runs in process. process roleentrypoint
started azure runtime first, runs onstart()
, enters infinite loop in run()
, instance opened http requests. if use iis 7.5 , have "autostart" enabled may have application_start()
executed earlier, otherwise won't have application_start()
executed until first request comes.
so key there're 2 different processes running code , each has own lifetime , dictates limitations on how can design application.
the roleentrypoint
descendant class can have name, belong namespace , located in .cs file within project selected payload web role - asp.net project. under these conditions roleentrypoint
descendant located azure runtime , methods run part of role instance lifetime.
Comments
Post a Comment