Microsoft recently launched .Net Core for Linux.  .Net core in Linux provides the same performance as that of Windows.

.Net core can be installed in RHEL 7, Ubuntu 14/16, Debian 8, Centos 7, Fedora 23, openSUSE 13.

Installation in Centos 7 is easy.

yum install libunwind libicu
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=827529
mkdir -p /opt/dotnet
tar zxf dotnet.tar.gz -C /opt/dotnet

Lets bootstrap a small .Net project.

cd /usr/local/src/
mkdir hwapp
cd hwapp
dotnet new

Great! Now you have created a new C# project in /usr/local/src/hwapp

Lets create a small web app.

Edit project.json file to include the Kestrel HTTP server package as dependency

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.1"
        },
       "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
      },
      "imports": "dnxcore50"
    }
  }
}

Restore packages

dotnet restore

Now we need to define the request handling login. Lets add Startup.cs for this.

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;

namespace hwapp
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(context =>
            {
                return context.Response.WriteAsync("Hello from ASP.NET Core!");
            });
        }
    }
}

Now, we need to setup and start the web host. Edit Program.cs as below

using System;
using Microsoft.AspNetCore.Hosting;

namespace hwapp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseUrls("http://0.0.0.0:5000")
                .UseKestrel()
                .UseStartup<Startup>()
                .Build();
            host.Run();
        }
    }
}

Lets run the app

dotnet run

Browser to http://yourserverip:5000/ to see the web page.

STILL SPENDING TIME ON SUPPORT?

Outsource your helpdesk support to save time and money. We have technicians available for little over 5 USD per hour in order to assist your customers with their technical questions. Grow your business and concentrate more on your SALES!

Xieles Support is a provider of reliable and affordable internet services, consisting of Outsourced 24×7 Technical Support, Remote Server Administration, Server Security, Linux Server Management, Windows Server Management and Helpdesk Management to Web Hosting companies, Data centers and ISPs around the world. We are experts in Linux and Windows Server Administration, Advanced Server Security, Server Security Hardening. Our primary focus is on absolute client satisfaction through sustainable pricing, proactively managed services, investment in hosting infrastructure and renowned customer support.