NET Core MVC creation and release on Linux

Source: Internet
Author: User
Tags dotnet

NET Core MVC creation and release on Linux

Objective

The ASP has been released for more than half a month, and the community has been very active recently, although it has been working on Python recently. NET obsession, looked at the park big God built the ASP. I was also eager to get ready for the creation and deployment of ASP. I have this article and hope to help you.

Environment preparation

This is my development environment, the use of Nginx is nginx 1.6.3 direct yum Install, and then need to install the dotnet environment, you can refer to the official website tutorial Https://www.microsoft.com/net/core#centos

Then create an ASP. NET core project using yeoman See official website https://aspnet-aspnet.readthedocs-hosted.com/en/latest/client-side/ Yeoman.html, because I didn't know how to create the ASPNET core MVC project with the dotnet directive, I had to use this. (later found the dotnet new-t Web, this directive is also to create an MVC Web project, see how silly I was then)

Create the first Web project

mkdir Demo1

CD Demo1

dotnet NEW-T Web

A Web project is generated under the Demo1 directory

Take a look at Project.json.

There are some project dependencies and Build,publish and runtime options. You can see Microsoft.AspNetCore.Server.Kestrel, which relies on Kestrel to listen for Web requests.

Execute dotnet Restore This instruction is primarily to find the project file (Project.json) under the current directory, then use the NuGet Library to restore the entire project's dependent library, then traverse each directory, build the project file, and continue to restore the dependencies in the project file

and experiment with dotnet run.

Here is I modified his binding address for http://*:5000, because the default is localhost:5000, but the time of the outside network access is a problem, check the information is said to be IP6 and IP4 reasons, so used the *, Using Useurls ("http://*:5000") in Program.cs

Then the browser visits to look at the effect:

Then I did the nginxd reverse proxy, yum install Nginx, and then modify the configuration file

Then perform the nginx-s reload restart Nginx configuration, then start the ASP. NET CORE program, enter 121.42.184.123 into the browser, and the results are as follows:

At this point, the ASP. NET Core program successfully tested on Linux, you can continue to execute dotnet publish instructions to package the release, packaging will generate a publish folder:

The browser accesses the results as well. Mood inexplicable excitement, loading big Microsoft.

Trying to manage the ASPNET core project with Supervisord, but due to the lack of configuration problems, Saturday to study, then prepare to study the ASPNET core project source code. Follow-up study will also be written out, hoping to make progress with everyone, the community's recent activity to let me right. NET is full of hope. Would like to cheer with you.

Reference: https://aspnet-aspnet.readthedocs-hosted.com/en/latest/client-side/yeoman.html

https://aspnet-aspnet.readthedocs-hosted.com/en/latest/

. NET Learning Technology Exchange Group: 226704167, willing to progress together with you!

NET Core MVC creation and release on Linux

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.