title: Operation timed out after publishing .net core app to iis?
body: <p>We've just built a .NET Core Web Application under VS2019 CE (deployed on a Windows Server 2012 R2 machine), but are facing some issues when trying to deploy it to IIS.</p>
  <p><strong>(EDIT)</strong> After publishing it to our IIS, recycling the app pool (for good measure), and even restarting the &quot;Default Web Site&quot; under IIS, it just sits there loading until the timeout value eventually gets exceeded, and we get the following:</p>
  <p><a href="https://i.stack.imgur.com/XnTiD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XnTiD.png" alt="" /></a></p>
  <p>This is troublesome, since the IIS page itself isn't giving us much more to go on, and even with stdout logging enabled, it doesn't seem to be writing to any logs (have tried giving both absolute and relative paths, but might be missing something/looking over something still? Obviously the logs would help tremendously).</p>
  <p>I've tried creating a application, then using Folder Publish from VS to no avail. I've also tried (the preferred way), publishing it directly to our IIS. Publish profile looking something like this (but, unfortunately, with a very similar result):</p>
  <pre><code> WebPublishMethod: MSDeploy
   LastUsedBuildConfiguration: Release
   LastUsedPlatform: Any CPU
   SiteUrlToLaunchAfterPublish: http://localhost:80/Visualiser
   LaunchSiteAfterPublish: True
   ExcludeAppData: False
   TargetFramework: netcoreapp2.0
   SelfContained: true
   MSDeployServiceURL: localhost
   DeployIISAppPath: Default Web Site/Visualiser
   SkipExtraFilesOnServer: False
   MSDeployPublishMethod: InProc
   EnableMSDeployBackup: False
   RuntimeIdentifier: win-x64
  </code></pre>
  <p>The app pool under IIS is set to No Managed Code, and I have also confirmed &quot;Enable 32-bit Applications&quot; is set to False. I have also added <code>&lt;AspNetCoreModuleName&gt;AspNetCoreModuleV2&lt;/AspNetCoreModuleName&gt;</code> under the projects *.csproj file, as it wasn't finding the module otherwise (but I don't feel like that should be too related?).</p>
  <p>Any and all help is appreciated. Thanks!</p>
  <p><strong>EDIT 2:</strong> I have now gotten the stdout logging to work (this by changing which account is used by the IIS App Pool). Initially we got <code>MS-ASPNETCORE-TOKEN does not match the expected pairing token</code> , which was fixed by adding <code>UseUrls()</code> in the project. However, after resolving that, all we are getting from the logs are the following, which is only digging us deeper into the rabbit hole:</p>
  <pre><code>info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
    User profile is available. Using 'C:\Windows\system32\config\systemprofile\AppData\Local\ASP.NET\DataProtection- 
  Keys' as key repository and Windows DPAPI to encrypt keys at rest.
  Hosting environment: Production
  Content root path: C:\inetpub\wwwroot\Visualiser
  Now listening on: http://localhost:16120
  Application started. Press Ctrl+C to shut down.
  info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost/Visualiser  
  </code></pre>
  <p>Last but not least, our <code>Program.cs</code> setup is currently looking like this:</p>
  <pre><code>public static IWebHost BuildWebHost(string[] args) =&gt;
          WebHost.CreateDefaultBuilder(args)
              .UseKestrel()
              .UseUrls(&quot;http://*:80&quot;)
              .UseContentRoot(Directory.GetCurrentDirectory())
              .UseApplicationInsights()
              .UseIISIntegration()
              .UseStartup&lt;Startup&gt;()
              .Build();
  </code></pre>