Search code examples
asp.net-mvciisdeployment.net-core-rc2

Server error 502 when deploying .NET Core RC2 in IIS


I developed an MVC web site using .NET Core RC2 in VS Code on my Mac and I tried to deploy it in Windows Server 2012 R2 IIS. I used https://docs.asp.net/en/latest/publishing/iis.html as reference. My project.json has Microsoft.AspNetCore.Server.IISIntegration, and Microsoft.AspNetCore.Server.Kestrel. My startup.cs has app.UseStaticFiles, app.UseSession and app.UseMVC.

I did

  • Review my IIS installation
  • Install .NET Core Windows Server Hosting Bundle and reset IIS
  • Copy all files to the server
  • Create web site and set application pool to No Managed Code as .NET CLR version
  • Add the default web.config for a .NET Core web site
  • Grant Application pool identity access to the files
  • Try to set the root at both project root and wwwroot

And I get the following error

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

What do I do wrong?


Solution

  • Following cesarbs hint I have made a dotnet publish, copied the generated folder to the website root and I recycled the application pool. It worked beautifully.