title: Why should i use a LoadBalancerProbe instead of subscribing to the RoleEnvironment.StatusCheck Event?
body: <p>I was fiddling with the options azure provides to balance the load between multiple webroles.</p>
  
  <p>I found three possible ways to do this.</p>
  
  <p>the first would be to do nothing at all and let the default ( round robin) implementation do the job.</p>
  
  <p>the second possibility would be to define a custom LoadBalancerProbe in the ServiceDefinitionFile, which i tried and did not get to work: From my understanding the custom aspx page is called each time a status check is performed on the role. Depending on the http response code the role changes its status to busy. - but this is never happening.
  Also, i couldnt really find any examples for defining a custom LoadBalancingProbe.</p>
  
  <p>Thus i looked for an alternative way to do this.</p>
  
  <p>Now iam subscribing to the RoleEnvironment.StatusCheck Event, which allows me to implement some logic and depending on the results set the role state to busy and available.</p>
  
  <p>My Questions:
  1) Supposing the Custom LoadBalancerProbe works as described in the MSDN, what is the difference between subscribing to the StatusCheckEvent and using a custom probe?</p>
  
  <p>2) Why does my custom load balancer probe not work ? - iam just testing with the azure emulator for now and iam well aware that traffic still gets routed to the webrole instances allthough they are set to busy in the emulator. 
  But my Custom Probe does not change the status of the webroleinstances at all.</p>
  
  <p>Here is the very rudimentary code, which should - to my knowledge set the status of webrole instance_n_0 to busy.</p>
  
  <pre><code>public class LoadBalanceController : Controller
  {
  
      public ActionResult Index()
      {
  
          WebOperationContext woc = WebOperationContext.Current;
          if(RoleEnvironment.CurrentRoleInstance.Id.ToLower().Contains("_0"))
          {
              woc.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.ServiceUnavailable;
          }else
          {
              woc.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK;
  
          }           
  
          return View(); //not relevant
      }
  </code></pre>
  
  <p>Ive also configered my servicedefinitionfile and set a Route to redirect to this controller/action when calling the healthcheck.aspx defined in the custom probe.</p>
  
  <pre><code>&lt;LoadBalancerProbes&gt;
      &lt;LoadBalancerProbe name="WebRoleBalancerProbeHttp" protocol="http" path="healthcheck.aspx" intervalInSeconds="5" timeoutInSeconds="100"/&gt;
  &lt;/LoadBalancerProbes&gt;
  ...
  &lt;InputEndpoint name="EndpointWeb" protocol="http" port="80" loadBalancerProbe="WebRoleBalancerProbeHttp"/&gt;
  </code></pre>
  
  <p>The Route:</p>
  
  <pre><code>    routes.MapRoute(
              name: "HealhCheck",
              url: "healthcheck.aspx",
              defaults: new { controller = "LoadBalance", action = "Index", id = UrlParameter.Optional }
  
          );
  </code></pre>