'Bad Gateway' error when loading aspnetcore RC2 default website project
Asked Answered
M

2

10

I am attempting to run the default ASP.NET Core Web Application (Web Application Template in VS 2015) via IIS.

I have followed the instructions from the docs here eg setting up a 'No Managed Code' application pool and pointing the Physical Path at the location of the web.config file.

When I attempt to browse to the website root, http://localhost I am getting this error:

HTTP Error 502.3 - Bad Gateway There was a connection error while trying to route the request.

Most likely causes: The CGI application did not return a valid set of HTTP errors. A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.

The event viewer states:

Failed to start process with commandline 'dotnet ./bin/Debug/netcoreapp1.0/WebApplication2.dll', Error Code = '0x80004005'.

This error shows I have replaced the placeholders

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"

in web.config with the required values

<aspNetCore processPath="dotnet" arguments="./bin/Debug/netcoreapp1.0/WebApplication2.dll"

(update: these placeholders are replaced when you publish)

As per the troubleshooting instructions I have installed .NET Core Windows Server Hosting Bundle and restarted the server.

Running from the command line via dotnet works

Wondering what to try now.

Mordy answered 21/5, 2016 at 11:13 Comment(0)
M
4

Ok I figured my issue out. I am pointing the physical path in IIS to the unpublished Visual Studio project root directory. This works in previous versions of .net (ie non dotnet core aspnet projects) but doesnt now.

If you really want this to work then you have to publish your app to a temporary folder and copy the Microsoft.AspNetCore.* binaries back into the bin\Debug\ folder along with the refs and runtimes folders

Mordy answered 21/5, 2016 at 11:55 Comment(2)
did you ever make IIS work with unpublished .Net Core projects? (looking at preview2 now instead of RC2)Insalubrious
Thanks a lot, I was having a nightmare because of this. In my case, it worked when I copied my published folder (default VS project root directory) to some other place and pointed IIS to that new path.Santos
M
-1

This is a generic error for when IIS can't find the specified .NET Core components ,and doesn't know where to forward requests. In addition to following the official IIS publishing guide, make sure you have:

  • Installed the correct versions from the download page for latest .NET Core releases
  • Specified the correct library versions (explicitly or with wildcards) in your project.json
  • Included a web.config file (preferably using the publish-iis tool), and that the <aspNetCore> key values have been replaced with local values (source, with examples)

I ran into this while setting up a Core 1.0.0 (final) website on a new Windows 2008 Server. Turns out I had mixed up some of the installers from my dev machine with newer versions, and had mismatched library versions (RC2 vs final). Reinstalling the Server Hosting package fixed the problem.

The key to troubleshooting was to get into the console and use the dotnet commands (and resulting error messages) to iterate until I had my site running from the console, since the IIS error page in the browser was useless. I also found some benefit in a few entries in the system Error logs, but not much.

Metameric answered 13/9, 2016 at 21:58 Comment(1)
Downvoter care to comment? Note that this question was specific to Core v1.0 RC2 - if you're working on a newer version of the framework, things have changed considerable and this answer may not be relevant to those versions.Metameric

© 2022 - 2024 — McMap. All rights reserved.