Create Your First ASP.NET Core Application On Ubuntu/Linux

Introduction

In this article, we will explore the basic steps to create and run the .NET Core Application on Ubuntu/Linux environment.

Install .NET Core on Ubuntu

For the installation steps, please visit: https://www.microsoft.com/net/core#ubuntu

Install

Please refer to this link to setup an Ubuntu Server in Azure.

Sometimes, it (access from Windows) may be slow, the other option you can use is Putti and connect to the Server. Execute the commands, given below: 

Once your environment is ready, run the commands, given below, in your terminal.

  1. sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'

    commands

  2. sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893.

    commands

  3. sudo apt-get update.

    commands

    Install .NET Core SDK.

  4. sudo apt-get install dotnet-dev-1.0.0-preview2-003121.

    commands

    Enter “y” to continue.

    commands

    commands

    Our installation is completed and we going to create our new Application.

    “Mkdir shijuse “ --- Create a new folder.
    “cd shijuse”.
    “dotnet new” -- Create a new Application, using CLI commands. 

    commands

    Now, our Application is created and we have to run our Application, using the commands, given below:

    “dotnet restore”.
    “dotnet run”.

    commands

    We have successfully run the Application.Have a look at the folder and the Application related items are created.

    folder

    The next step, we are going to create is a Web Application.

    “Mkdir shijuseWeb “ --- Create a new folder.
    “cd shijuseWeb”.
    “dotnet new –t web” -- Create new Web Application, using CLI commands.

    commands

    Our new Web Application is created. Next, we have to restore all the dependencies and run, using CLI commands, given below:

    “dotnet restore”
    “dotnet run”

    commands

    Open the Browser and run http://localhost:5000.

    Yes …our new Application is working fine.

    application

Please have a look at the Application folder.

application

Conclusion: In this article, we learned, how to create and run the .NET Core Application in Ubuntu/Linux Server.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now