سؤال

I'm playing with Azure sample from here on Compute Emulator and I found that if I make OnStart() in my class inherited from RoleEntryPoint rather slow to return the .aspx page in the web role accepts HTTP requests even before OnStart() returns.

I find it rather confusing - why would IIS accept requests to the role that hasn't yet started?

هل كانت مفيدة؟

المحلول

The emulator does not emulate the load balancer 100%. For the cloud, when your role is in OnStart() you are reported to the LB as Busy and no traffic will be routed to it. Once you return from OnStart() with true, it will take a few seconds or so but only then will the LB start to route to it. You can test this yourself by tracing in your OnStart() and putting a big Sleep() in there. You won't be able to reach your instance (over non lingering ports).

You can of course ask the LB to ignore the Ready status and it will route even when busy - that is done by specifying ignoreRoleInstanceStatus="true" on the endpoint.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top