title: ASP.NET Core app not working after publish to Azure
body: <p>I have an ASP.NET Core app which is running fine locally.</p>
  
  <p>However, when I <strong>publish</strong> (Web Deploy) the site to Azure, I get a <strong>403</strong>: <code>You do not have permission to view this directory or page</code>.</p>
  
  <p>I have a default controller and a route defined in <strong>Startup.cs</strong>:</p>
  
  <pre><code>app.UseMvc(routes =&gt;
              {
                  routes.MapRoute(
                      name: "default",
                      template: "{controller}/{action}/{id?}",
                      defaults: new { controller = "Home", action = "Index" });
              });
  </code></pre>
  
  <p>The folder structure after web deploy to Azure looks like:</p>
  
  <pre><code>|_ home
    |_ site
      |_ wwwroot (contains DLL's and files specified through 'publishOptions' in project.json)
        |_ wwwroot (the contents of the 'wwwroot' folder I have in Visual Studio)
        |_ Views (contains MVC views)
        |_ refs (contains referenced DLLs, I think?)
  </code></pre>
  
  <p>Any idea of what I should look for in project.json or the Kudu portal to figure out what's wrong?</p>
  
  <p>My <code>project.json</code> file:</p>
  
  <pre><code>{
    "title": "My Web App",
    "version": "1.0.0-*",
    "buildOptions": {
      "debugType": "portable",
      "emitEntryPoint": true,
      "preserveCompilationContext": true,
      "compile": {
        "exclude": [ "bin/**", "obj/**", "node_modules/" ]
      }
    },
    "publishOptions": {
      "include": [ "wwwroot", "Views", "appsettings.json", "appsettings.*.json" ]
    },
    "scripts": {
      "prepublish": [ "jspm install", "gulp build" ]
    },
    "dependencies": {
      "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
      "Microsoft.AspNetCore.Diagnostics": "1.0.0",
      "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
      "Microsoft.AspNetCore.Mvc": "1.0.0",
      "Microsoft.AspNetCore.StaticFiles": "1.0.0",
      "Microsoft.Extensions.Configuration.Json": "1.0.0",
      "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
      "Microsoft.Extensions.Logging.Console": "1.0.0",
      "Microsoft.Extensions.Logging.Debug": "1.0.0",
      "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
      "System.IO.FileSystem": "4.0.1"
    },
    "frameworks": {
      "netcoreapp1.0": {
        "dependencies": {
          "Microsoft.NETCore.App": {
            "type": "platform",
            "version": "1.0.0"
          },
          "Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
        },
        "imports": "dnxcore50"
      }
    },
    "commands": {
      "web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://*:8000/"
    }
  }
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>For one, I was missing the <code>Microsoft.AspNetCore.Server.IISIntegration</code> NuGet package. When I added it, I also got a <code>web.config</code> file in the site root (which I included through <code>project.json</code>).</p>
  
  <p>I also added <code>.UseIISIntegration()</code> to my <code>WebHostBuilder</code> in <strong>Startup.cs</strong>:</p>
  
  <pre><code>public static void Main(string[] args)
  {
     new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseStartup&lt;Startup&gt;()
        .UseIISIntegration() // This was missing
        .Build()
        .Run();
     }
  </code></pre>
  
  <p>I can now run it on <strong>IIS Express</strong> locally (although I guess it's IIS fronting Kestrel?), but when published to Azure I get error:
  <code>HTTP Error 502.5 - Process Failure</code></p>
  
  <p>The event log in Azure states: <code>Failed to start process with commandline '"%LAUNCHER_PATH%" %LAUNCHER_ARGS%', ErrorCode = '0x80070002'.</code></p>
  
  <p>According to the documentation, the troubleshooting step is:</p>
  
  <p><code>If the server does not have Internet access while installing the server hosting bundle, this exception will ensue when the installer is prevented from obtaining the Microsoft Visual C++ 2015 Redistributable (x64) packages online. You may obtain an installer for the packages from the Microsoft Download Center.</code></p>
  
  <p>Not sure how this applies to <strong>Azure</strong>, though?</p>