Report this

What is the reason for this report?

How to deploy ASP.NET Core application?

Posted on December 2, 2016

I created a sample ASP.NET Core Web API application with MondoDB following these tutorials

  1. [Using MongoDB .NET Driver with .NET Core WebAPI] (https://www.codeproject.com/articles/1151842/using-mongodb-net-driver-with-net-core-webapi)
  2. Publish to a Linux Production Environment
  3. Publishing an ASP.NET Core website to a cheap Linux VM host

Excited about the prospect of deploying an ASP.NET application in a Linux environment, i got the $5 plan and installed Ubuntu.

I have been successful in running the application and nginx locally with the application listening @ port 5000. However, i’m unable to access my application from outside. I’m getting the ‘502 bad gateway’ error.

Could anyone with experience on the above stack help me out? Thanks for your time.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

A 502 error usually means one of two things.

1.) Your application is not listening locally as expected on http://localhost:5123

Test this by using wget/curl or telnet to open the service from from your ssh session on the server and make sure it responds. If it’s not, try restarting supervisor.

2.) Your nginx configuration is not correct.

Share your nginx configuration here and we can take a look at it.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.