This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15994|Reply: 1

[ASP.NET] . .NET Cross-Platform: Compile dnx on CentOS and run ASP.NET 5 sample programs

[Copy link]
Posted on 7/9/2015 10:38:49 AM | | |
In a previous blog post, we successfully compiled dnx on Ubuntu and successfully ran %26nbsp with it; ASP.NET 5 Sample Program. In this blog post, we swap Ubuntu for CentOS.

Currently, DNX requires mono to be compiled, so you need to install mono first, and it is best to compile and install it with the latest mono source code.

The steps we actually managed to successfully compile are as follows (assuming mono is installed to %26nbsp; /data/mono_build directory):

mkdir /data/mono_build
PATH=/data/mono_build/bin:$PATH
git clone https://github.com/mono/mono.git
cd mono
./autogen.sh --prefix=/data/mono_build
make get-monolite-latest
make
make install
Note: %26nbsp is not used at the beginning; make get-monolite-latest, and it fails when making because it can't find mcs.

If you want to always use this self-compiled mono, you need to add the following configuration to ~/.bash_profile:

export PATH=/data/mono_build/bin:$PATH
Next, install dnvm with the following command:

curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh %26amp; %26amp; source ~/.dnx/dnvm/dnvm.sh
Then you can compile dnx:

# ./build.sh
Installing 'KoreBuild 0.2.1-beta6-10166'.
Successfully installed 'KoreBuild 0.2.1-beta6-10166'.
Installing 'Sake 0.2'.
Successfully installed 'Sake 0.2'.
Determining latest version
Latest version is 1.0.0-beta6-12085
Downloading dnx-mono.1.0.0-beta6-12085 from https://www.myget.org/F/aspnetvnext/api/v2
Download: https://www.myget.org/F/aspnetvnext/api/v2/package/dnx-mono/1.0.0-beta6-12085
######################################################################## 100.0%
Installing to /root/.dnx/runtimes/dnx-mono.1.0.0-beta6-12085
Adding /root/.dnx/runtimes/dnx-mono.1.0.0-beta6-12085/bin to process PATH
Setting alias 'default' to 'dnx-mono.1.0.0-beta6-12085'

...

Attempting to build package from 'dnx-mono.nuspec'.
Successfully created package '/data/git/dnx/artifacts/build/dnx-mono.1.0.0-t150618141518.nupkg'.
info: Target package
After the compilation is successful, you can use %26nbsp; The dnx in artifacts/build/dnx-coreclr-linux-x64/bin is running the ASP.NET 5 sample program.

Check out the ASP.NET 5 sample program from GitHub first:

https://github.com/aspnet/Home.git
Preparation before running:

1) Enable dnvm

source /root/.dnx/dnvm/dnvm.sh
2) Install OpenSSL

yum install -y openssl-devel
Otherwise, the following error will occur:

System.TypeInitializationException: The type initializer for 'libcrypto' threw an exception.
---%26gt; System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
   at Interop.libcrypto.. cctor()
3) Compile and install %26nbsp; libuv (to run kestrel)

git clone https://github.com/libuv/libuv.git
sh autogen.sh
./configure
make
make install
ldconfig
Otherwise, the following error will occur:

System.InvalidOperationException: Unable to load libuv. Make sure libuv is installed and available as libuv.so.1
Then run the three ASP.NET 5 sample programs in Home/samples/latest/ separately (run dnu restore before running).

1)ConsoleApp

[root@server1 ConsoleApp]# /data/git/dnx/artifacts/build/dnx-coreclr-linux-x64/bin/dnx . run
Hello World
2)HelloWeb

[root@server1 HelloWeb]# /data/git/dnx/artifacts/build/dnx-coreclr-linux-x64/bin/dnx . kestrel
Started
3)HelloMvc

[root@server1 HelloMvc]# /data/git/dnx/artifacts/build/dnx-coreclr-linux-x64/bin/dnx . kestrel
Started
I also successfully experienced cross-platform .NET on CentOS.




Previous:Linux tail outputs the last few lines of the file
Next:Linux modifies the user and group to which the file belongs
Posted on 7/10/2015 12:57:42 AM |
It feels great, but I can't understand it
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com