title: Azure warm up on web api is not working
body: <p>I have a website with some webservices written with web api 2 and .net 4.6. I want the application to be initialized when I restart the site or when I spin up a new instance (on Azure app service).</p>
  
  <p>I have this code in webconfig:</p>
  
  <pre><code>&lt;configuration&gt;
   ,,,,
    &lt;system.webServer&gt;
  
         ...
  
    &lt;applicationInitialization doAppInitAfterRestart="true"&gt;
    &lt;add initializationPage="/"  /&gt;
    &lt;add initializationPage="/api-v2/warmup/get"  /&gt;
  &lt;/applicationInitialization&gt;
  </code></pre>
  
  <p>I have this controller:</p>
  
  <pre><code>public class WarmupController : ApiController
  {
     [HttpGet]
      [RequireRole(UserRole.None)]
      [IgnoreTypeScriptGeneration]
      public IHttpActionResult Get()
      {
          Log.Information($"Warming up started. {Environment.MachineName}");
           // my warm up code
           Log.Information($"Warming up succeeded. {Environment.MachineName}");
          return Ok();
      }
  </code></pre>
  
  <p>I cannot see any logs. Not when I restart the site nor when I do scale out.
  I've tried to call my api using postman without any headers (just a get to <a href="http://xxx//api-v2/warmup/get" rel="nofollow noreferrer">http://xxx//api-v2/warmup/get</a> and it worked fine and also wrote to my logs.</p>
  
  <p>I've already read this thread: <a href="https://stackoverflow.com/questions/48621207/cannot-warm-up-pages-using-applicationinitialization-in-webconfig">Cannot warm up pages using applicationInitialization in webconfig</a></p>
  
  <p>-There is no Ip restrictions on the Azure nor on the webconfig</p>
  
  <p>-There is no url rewrites in webconfig ( like for https or for www.)</p>
  
  <p>-There is no external system involved (like a CMS) so I shouldn't need ot send the  hostName but I've also tried to send that and it didn't work</p>