Developing ASP.NET Core App in Visual Studio and Deploying on Simple Application Server

Quick FAQ

Developing Example Application


Create ASP.NET core project from template

Edit and Change Code

<a asp-page="/Index" class="navbar-brand">Alibaba SAS Demo</a>

Run Application

Publish Example Project for Deployment

Prepare the Web Application

<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
app.UseForwardedHeaders(new ForwardedHeadersOptions
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>

Publish Project as Self-Contained Application

Publish from Visual Studio

Publish from Command Prompt

dotnet publish -c release -r linux-x64

Create a Simple Application Server Instance on Alibaba Cloud

Log in and Select Simple Application Server

Setup Server Configuration

Deploy application on simple application server

Create Password

Install Prerequisites on Server

sudo yum -y update
sudo yum install nginx
sudo service nginx start
systemctl status nginx
sudo yum update
sudo yum install nano
sudo yum update
sudo yum install supervisor

Deploy Application

chmod +x alibabadotnetcore

Configure Nginx

sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
sudo nano /etc/nginx/nginx.conf
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
sudo nginx –t
sudo nginx -s reload
cd dotnetappdir/publish

Final Steps

nginx error!
The page you are looking for is temporarily unavailable. Please try again later.
cp -r ~/dotnetappdir /var
touch /var/dotnetappdir/startscript
nano /var/dotnetappdir/startscript
cd /var/dotnetappdir/publish
chmod +x /var/dotnetappdir/startscript
nano /etc/supervisord.conf
sudo supervisord -c /etc/supervisord.conf




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store