2

I'm trying to get GitHub Codespaces working with a simple asp.net core web app.

I've created a new asp.net core web app (dotnet new webapp), confirmed it all works locally, and then added it to an Organization GitHub repo.

From here, I open the repo in Codespaces, in the browser.

I've configured the container for C# and Sql, my docker files are unchanged from the ones that are generated.

I can build fine, then I dotnet run from the Terminal and I can see the app starts up fine:

Info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]```

I also get a message about port forwarding, and I can see that port forward set up:

![enter image description here

However, when I try that URL, I get an NGINX 502 Bad Gateway error from the 5001 port. From the 5000 port URL it just tries to redirect me to https://localhost:5001.

Am I missing some part of setup?

Things I've tried

  • Adding forwardedPorts to the devcontainer.json file.
  • Toggling the port forward to public / private
  • Changing the Port Protocol to https
  • Logging in and out of github, and rebuilding the devcontainer many times.
Matt Roberts
  • 26,371
  • 31
  • 103
  • 180
  • Did you use dockerfile? You can read this article to configure it, which may help you:https://github.com/dotnet/docfx/issues/3615#issuecomment-451664865 – Tupac Oct 29 '21 at 06:16
  • It generates a docker file so I assume the answer is yes?. I can’t see any reference to nginx in the config, the only way I know it’s using nginx is the error message. – Matt Roberts Oct 29 '21 at 07:18

1 Answers1

2

Cross-posting https://github.com/github/feedback/discussions/7116, where this seems to be discussed more heavily. We can update this when we've got a firm answer.

Mike McDonald
  • 15,609
  • 2
  • 46
  • 49