Malekbenz

Hi, I'm MalekBenz. I author this blog, I'm FullStack Developer, create courses & love learning, writing, teaching technology. ( Javascript, C#, ASP.NET , NodeJS, SQL Server )

Create aspnet core website on cloud9

ASP.NET MVC core is a framework for building web applications that applies the general Model-View-Controller pattern to the ASP.NET framework.

In this post we will use Asp.NET core to create Web application on cloud9 using different technologies Yeoman, gulp and nodejs .

If you don’t kown how to create a simple web server you can see Create a First web application with .Net Core .

Create a new workspace in cloud9

Go to Cloud9 website and signin.

CMD

Select Create a new workspace

CMD

Name the workspace aspnet, Select Blank template and click on Create a new workspace

CMD

Now your machine is created, type sudo apt update update the system.

CMD

Install the package apt-transport-https.

CMD

Install Yeoman (gulp & bower)

Yeoman is web scaffolding tool for modern webapps, Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive.

First of all we need to upgrade npm (node packgae manager): :

    $ npm install npm     

CMD

And then install Yeoman,Gulp and bower globaly :

    $ npm install -g bower gulp yo     

CMD

To be able to create new aspnet project with Yeoman we need to install aspnet generator so let’s do it:

    $ npm install -g generator-aspnet    

CMD

Install .NET Core

Now let’s install .NET Core, In order to install .NET Core you need to first set up the apt-get feed that hosts the package you need.

    $ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    
    $ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    
    $ sudo apt-get update

Install .NET Core SDK Before you start, remove any previous versions of .NET Core from your system.

To .NET Core on Ubuntu or Linux Mint, simply use apt-get.

    $ sudo apt-get install dotnet-dev-1.0.0-preview2-003131
    

To confirm that donet is installed:

    $ dotnet --version

And you’re ready!

CMD

Create the application with Yeoman

You now have .NET core running on your machine You can create a website with Yeoman.

    $ yo aspnet

Select Web application

CMD

Select Bootstrap then press enter

CMD

now name the application webapp then press enter

CMD

Your project is now created, you can use the following commands to get going

    $ cd "webapp"
    $ dotnet restore
    $ dotnet build
    $ dotnet ef database update

Befor run the app we need to update Program.cs file to be able to listen on port 8080:

    UseUrls("http://0.0.0.0:8080")

CMD

Now You can run your application :

    $ dotnet run

CMD

To preview your running app, try to use port 8080 in the URL ex: https://aspnet-malekbenz.c9users.io/.

Comments