Set up an ASP. NET Core environment under ECs, asp. netcore

Source: Internet
Author: User

Set up an ASP. NET Core environment under ECs, asp. netcore

Recently,. net core is in full swing, and there are a lot of documents on domestic environment construction, but many of them are outdated. Even if you follow that process, you won't be able to avoid differences in some places for a long time. So next I will teach you how to build an environment from start to end and successfully run the demo on the official website.

1. System Environment

This time, I registered a trial account of the cloud provider as the host because I was too lazy to do virtual machines.

System: Ubuntu Server 14.04.2 LTS 64bit

Mono: 1.0.0-rc1-update1

Coreclr: 1.0.0-rc1-update1

Ii. Text

1. First install the Mono Environment

1.1 In the console, enter:

The content is as follows:

Copy codeThe Code is as follows: sudo apt-key adv -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

1.2 continue with the input:

The content is as follows:

Copy codeThe Code is as follows: echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee/etc/apt/sources. list. d/mono-xamarin.list

1.3 continue installation:

The content is as follows:

Copy codeThe Code is as follows: sudo apt-get update

1.4 The last step is to officially download and install mono, which takes a long time.

The content is as follows:

Copy codeThe Code is as follows: sudo apt-get install mono-complete

1.5 after completing the preceding steps, check whether the installation is successful and the version is correct. You need to enter the following command to check whether the installation is successful.

Note that after the reader completes the installation, check the version number. Your version number should be the same as or higher than me. If it is lower than me, the installation will fail, therefore, make sure that the correct version of Mono is installed.

2. Install. Net version control (DNVM)

The content is as follows:

Copy codeThe Code is as follows: curl-sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH = dev sh & source ~ /. Dnx/dnvm. sh

3. Install DNX

DNX is the net running environment. Currently, two methods are provided: mono and. net core. I will install two methods and use these two environments to run our programs separately.

3.1 install necessary tools for DNX

The content is as follows:

Copy codeThe Code is as follows: sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev

3.2 install DNX for. net core

We can see that the version we are currently downloading is 1.0.0-rc1-update1.

The content is as follows:

Copy codeThe Code is as follows: dnvm upgrade-r coreclr

3.3 install DNX for mono

Previously, we only installed mono, but did not install the mono sdk corresponding to DNX.

The content is as follows:

Copy codeThe Code is as follows: dnvm upgrade-r mono

3.4 verify our installed DNX

The following command is used to view some of the DNX versions currently installed:

We can see that we have installed the corresponding mono implementation and coreclr implementation, so you must understand the relationship between dnvm, dnx, mono and coreclr.

3.5 install libuv

This is a library that must be installed to run the Web. The related commands are as follows.

Copy codeThe Code is as follows: sudo apt-get install make automake libtool curlcurl-sSL https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv--C/usr/local/srccd/usr/local/src/libuv-1.8.0sudo sh autogen. shsudo. /configuresudo makesudo make installsudo rm-rf/usr/local/src/libuv-1.8.0 & cd ~ /Sudo ldconfig

4. Run the official example

4.1 to download examples from the official website, install git first.

After the installation is complete, download the instance from the official website to your local device.

Then we switch to the corresponding directory and use the following command on the author's machine to go to the corresponding version of the instance.

After switching to this directory, we can use ls to view which instances are available:

By default, the official console is provided, with three examples: asp.net 5 and asp.net mvc 6.

4.2 Use mono and coreclr to run the console example

First, switch to the directory:

Then restore the referenced database:

The installation time depends on the reader's network environment. If the following page is displayed, the installation is successful:

Then we can use DNX to run:

The output is correct.

Next we will switch DNX to coreclr to run the program:

After the switchover is successful, run the following command:

The content is also successfully output.

4.3 run mvc using mono and coreclr

First, we need to switch to the corresponding directory and remember that our DNX is Coreclr:

Restore referenced database:

This time may be relatively long because there are many referenced libraries. The following figure shows the successful installation:

This operation is not dnx run. If you want to try it, you can try to run it. I believe the reader can understand the final error. here we need to run it using other commands (dnx web ):

We successfully saw the final result. Next we switch to mono to run it once.

Still running DNX Web

Refer:

Http://druss.co/2015/03/vnext-install-asp-net-5-dnx-on-ubuntu/

Https://docs.asp.net/en/latest/getting-started/installing-on-linux.html

Https://github.com/dotnet/coreclr/blob/master/Documentation/install/get-dotnetcore-dnx-linux.md

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.