Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ Understand ASP.NET 5 running the command: DNVM, DNX, and DNU     - independently configurable PHP environment under CentOS6.5 (Server)

- 20 Advanced Java interview questions summary (Programming)

- shell script: MySQL startup script simple (Database)

- Ubuntu installed Gimp 2.6.11 (stable version) with PPA (Linux)

- CentOS 7 open ports (Linux)

- Tab set to four spaces in Vim (Linux)

- iptraf: A Practical TCP / UDP network monitoring tools (Linux)

- Oracle PL / SQL selective basis (IF CASE), (LOOP WHILE FOR) (Database)

- Chkconfig command Detailed service is added and shut down the system in two ways to start service under Linux (Linux)

- MySQL5.7 implement virtual column expression index (Database)

- Linux performance optimization features Tuned and ktune (Linux)

- Installation JDK 1.8 under CentOS7 (Linux)

- Analysis of Java in the deep copy and shallow copy (Programming)

- C ++ constant definition (Programming)

- How to set up HTTPS policies for older browsers (Server)

- Manually create Oracle Database Explanations (Database)

- Android determine the device network connection status, and determine the connection (Programming)

- LNMP summary of the issues common 502 Bad Gateway (Server)

- To remove those IP is prohibited Fail2ban on CentOS 6/7 (Server)

- Linux RPM default installation path (Linux)

  Understand ASP.NET 5 running the command: DNVM, DNX, and DNU
  Add Date : 2018-11-21      
  ASP.NET 5 introduces a new run-time, so that we can live delivery model to build modular applications, without relying on the .NET Framework on the host. This new model provides us with a command-line tool (DNVM, DNX, DNU) to manage our .net version of dependent libraries and runtime environment, we do not need Visual Studio, only you need a text editor and the command line you can develop an application.

Learn .NET Version Manager (DNVM) between, .NET execution environment (DNX) and .NET development utilities Relations (DNU) is between 5 to develop ASP.NET fundamental. In this article we will look at the installation and use DNVM, DNX and DNU, the command line and the development of a simple text editor application in CentOS, if you use a docker, these commands and docker is really like.

DNVM (.NET Version Manager): Due to the cross-platform directory, Microsoft provides DNVM function, DNVM ASP.NET is the bottom of the content, it is a set of Powershell scripts used to start the specified version of ASP.NET runtime environment and can make the appropriate upgrade on the same machine the same point in time by using Nuget tools to manage various versions of ASP.NET runtime environment (DNX), as well.

DNX (.NET Execution Environment): DNX is running ASP.NET environment program for the program up and running ASP.NET. The runtime environment includes a compiler system, SDK tools, Native CLR hosted environment. You can use various versions of DNX DNVM management, such as dnvm list command lists all available DNX environment, dnvm install 1.0.0-beta4 you can specify the version of DNX installed .dnx folder, you can% USERPROFILE % \ next dnx \ runtimes directory locate all versions of DNX installation. Different operating systems have different versions of DNX.

dnx.exe: dnx.exe is used to start from the host environment (Self-Hosting) command line tool when you use the command line to start the program self-hosted environment, dnx is responsible for finding and call CLR Native Host, dnx entire command entry point operating environment, you can use dnx run to start the program.

dnu (DNX Utility): is a command line package manager, included in the DNX, so long as the installation of DNX, you can use dnu command, which can be used in the recovery package, the installation package, deploy the package, and so on, for example, the program project.json in custom set automatically downloaded for use.

DNX structure and operation principle

DNX is the core ASP.NET program runs, it follows that the following two criteria:

DNX should be self-contained, DNX analytic application after completion dependency tree in order to know which one to use Core CLR package, so before you get a parse tree, DNX is unable to load any CLR, except Roslyn compiler.
Dependency injection (Dependency Injection, abbreviated DI) throughout the entire system stack, DI is a core part of DNX, DNX all libraries are built on top of the DI.
Layered architecture DNX execution environment are as follows:

Layer 0: Native Process

This layer is very simple, is mainly used to find and call the Layer 1 in the CLR Native Host, and system-related parameters passed to the native host, for subsequent use. Windows is currently using the following DNX.exe to deal with this matter, while IIS also provides an intermediary (website under bin directory provides a AspNet.Loader.dll) can forward the request to the Native Host; while Linux and Mac versions through their respective dnx to support this feature.

DNX Usage:

dnx.exe --lib {paths} --appbase {path} [ProgramName]

--lib {paths}: assembly dll saved address (usually set of third-party programs and projects precompiled assembly reference), the address is a Layer 2 unmanaged code entry point layer can load local assembly.

--appbase {path}: program storage directory, the default is% CD%.

[ProgramName]: the name of the program, the program where the assembly (or containing Programe :: Main's dll) stored at --lib path, the default value is appbase \ project.json in the name. In most cases, the names are loaded chain contains the program host (Microsoft.Net.ApplicationHost). However, if your program contains the entry point (Main method), and is compiled into the next --lib directory, you can use the name of the assembly as [ProgramName], this approach completely ignore the load chain and direct start your program.

Layer 1: CLR Native Host

This layer depends on the content of your choice then CLR version, this layer has the following two functions:

Start CLR, CLR depends on what you choose to start the CLR version. If Core CLR, the layer loads coreclr.dll, configure and start the operating environment, and then create an application domain (AppDomain), all managed code to run.
Call unmanaged code entry point (Layer 2), once the Native Host entry point returned to the thread, the CLR thread will clean up and close, for example, to unload an application domain (AppDomain) and stops operating environment.
Layer 2: Managed Entry Point

Layer 2 Layer (Trusteeship code entry) is written in the first layer of managed code, the following responsibilities:

Create LoaderContainer (comprising ILoaders required), ILoader responsible according to the assembly's name to load the assembly. CLR requires an assembly, then, LoaderContainer will be used to parse its ILoader assembly required.
--lib From the path to the directory with root ILoader to load the assembly, and parses its dependencies.
The main entry point of the caller.
Layer 3: Application host / Application

If the developer will compile the entire program into an assembly on libpath directory, that is, the layer of your application. Parameters used when the program containing the program entry point, as set name [ProgramName] to incoming, Layer 2 layer will directly call the assembly.

Typically, however, in other cases, the application will use a host (Application host) to parse the contents of the program dependent and start running the program. Microsoft.Net.ApplicationHost is an application runtime environment provided by the host, and has the following duties:

Resolve various dependent assembly defined in project.json.
A ILoader added to LoaderContainer, in order to load the appropriate assembly from a variety of places (such as source code, NuGet, Roslyn, etc.).
Call the entry point of the assembly, which was used as the parameter passed to DNX.exe.
Layer 4: Application

This layer is the developers of the program, the host application running on top of it.

Environment configuration:

To run the program environment DNX ASP.NET 5 is configured, you first need to install and configure DNVM, you need to install on CentOS and other Linux systems Mono, Mono 4 and Jexus can be deployed on CentOS 5.6 with reference to article 7. Then run the following command

curl -sSL https://raw.githubusercontent.com/aspnet/Home/master/dnvminstall.sh | sh && source ~ / .dnx / dnvm / dnvm.sh

[Root @ Mono ~] # curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH = dev sh && source ~ / .dnx / dnvm / dnvm.sh

Downloading dnvm as script to '/root/.dnx/dnvm'

Appending source string to /root/.bash_profile

Type 'source /root/.dnx/dnvm/dnvm.sh' to start using dnvm

After the above-mentioned DNVM installation, the system will copy the files to /root/.dnvm dnvm directory and add /root/.dnvm directory to environment variable, so that can be used globally. Note: This is only installed DNVM, and did not install any version of DNX, DNX if you want to install, you can run dnvm or dnvm help to find the relevant command, using the following command:

dnvm upgrade [-x86] [- x64] [-svr50] [- svrc50] [-g | -global] [-proxy < ADDRESS>]

DNX install the latest version from the feed source
DNX is set to installed a default (default) aliases
Add the user of DNX bin PATH environment variable
-g | -global globally within the installation (you can also use other users)
-f | -force strong update to the latest version (even if already installed the latest version)
When -proxy access the remote server using a specific address as a proxy

dnvm install < semver> | < alias> | < nupkg> | latest [-x86] [- x64] [-svr50] [- svrc50] [-a | -alias < alias>] [-g | -global] [- f | -force]

| Feed from the source installation specified DNX
From the local file system installation specified DNX
DNX latest install the latest version from the feed source
Adding DNX bin to the current command line path environment variable
-p | -persistent add DNX bin to the system PATH environment variable
-a | -alias specified installation DNX set the alias
-g | -global globally within the installation
-f | -force mandatory installation specified DNX (even though this version has been installed over)
dnvm use < semver> | < alias> | none [-x86] [- x64] [-svr50] [- svrc50] [-p | -persistent] [-g | -global]

| DNX bin will add to the current command line path environment variable
none DNX bin will be deleted from the current command line path environment variable
-p | -persistent add DNX bin to the system PATH environment variable
-g | -global combination -p user to modify the system PATH PATH
dnvm list // list all installed versions DNX

dnvm alias // lists all defined aliases DNX version

dnvm alias < alias> // display defines the alias name DNX

dnvm alias < alias> < semver> [-x86] [- x64] [-svr50] [- svrc50] // to set up an alias specified DNX version

dnu command and feed source configuration management procedures set

By dnu package management commands, we usually use the following command:

dnu restore: query program all dependent packages, and all packages downloaded to the directory, the command will download the entire package and the dependencies rely package depends other dependencies.
dnu install : The install command downloads the specified package and added to the program.
dnu publish: This command will your program can run packaged into a self-contained directory. It will create the following directory structure:

output /

output / packages

outpot / appName

output / commandName.cmd

packages directory contains all applications required package.

appName directory contains all the code for the application, if you reference other projects, other projects cited in the same directory will also create their own projects, which will generate a directory and AppName similar.

publish command, the commands will project.json node various commands were generated in response to a command line files, such as commands in the command of the web, we can dnx web: open run it (format dnx ) .

Since dnu internally use Nuget command to manage the package, so use the time to properly configure Nuget the feed source, the current ASP.NET 5 related packages are on myget feed, so we need to add this feed to run properly . ~ / .config / NuGet / NuGet.config configuration information in a file under * nix using Mono to be managed

Start building a program from the command line console

We use vim and dnx / dnu build a simple command line program that creates a directory dnx_demo, project.json create a file in the directory that contains the following elements:


"Version": "1.0.0- *",

"Description": "geffzhang demo project",

"Commands": {

"Runme": "dnx_demo"


"Frameworks": {

"Dnx451": {},

"Dnxcore50": {

"Dependencies": {

"System.Console": "4.0.0-beta-22816",

"Microsoft.CSharp": "4.0.0-beta-22816"





Above, we define a command "runme", it points to the name of the project: dnx_demo. We can use the command line dnx run our projects, we project points to the traditional .NET Framework (dnx451) and .NET Core (dnxcore50), so we can use dnx and .net fx run.

Then create a Program.cs file, as follows:

using System;

namespace dnx_demo


public class Program


public void Main (string [] args)


Console.WriteLine ( "No Visual Studio Here !!");

Console.Read ();




Once saved, we run the command dnu restore, we will rely on the program package to package directory.

Currently the program we run is just a very simple console program does not include EF, SignalR, Identity and other complex components, but the entire deployment process, we can actually feel the gap is very small. First run and deployment environment DNVM and dnu, dnx command and VS 2015 environment is the same, and component packages are available on Nuget, and this standard Windows development environment and there is not much difference.
- Dalvik heap memory management and recycling (Linux)
- Oracle PL / SQL selective basis (IF CASE), (LOOP WHILE FOR) (Database)
- C # socket udp broadcast (Programming)
- JDK installation notes under CentOS (Linux)
- To use yum install VLC under CentOS (Linux)
- Linux Getting Started tutorial: XWindow what (Linux)
- SUSE Linux network configuration and firewall configuration (Linux)
- Java reflection mechanism explained in detail and Method.invoke explanation (Programming)
- Use the vi text editor and copy and paste Linux tips (Linux)
- The new features of MySQL 5.7 Generated Column (index function) (Database)
- Example of use WebSocket (Programming)
- Automate deployment of Docker-based Rails applications (Server)
- How to identify memory leaks in Java (Programming)
- Additional SQL Server 5123 database reported error (Database)
- Git uses a basic tutorial (Linux)
- Nginx logging client ip (Server)
- Configuring automatic mail GAMIT under CentOS system (Linux)
- Linux environment MySQL master-slave synchronization (Database)
- Linux Network Security: nmap port scanning software (Linux)
- Swift string common method (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.