. NET core installation and initial experience

Source: Internet
Author: User
Tags web hosting

. NET core installation and initial experience

As Microsoft's next-generation technology,. NET core has great advantages in developing cross-platform, micro-services, and is also more closely related to modern coding habits. A long time after the release of version 2.0, the recent decision to learn and experience.

Installation

As a. NET programmer, the most convenient development tool is, of course, Visual Studio. Although. NET core can be developed in tools such as vs code, I still use Visual Studio as a development tool.

Install Visual Studio 2017 first, download and install it yourself, and check. NET core when you install.

When the installation is complete, open the console to verify that the installation is successful. In console input:

dotnet --version

If the installation succeeds, the current. NET Core version number is displayed

Hello World

No matter how complex the program, our best start is to complete a Hello World instance first. We open vs, create a new console application (. NET core), enter the project name, and then OK.

The entrance to the program is still the static main method of the Programs class, in which the code for the output of Hello World has been completed for us:

class Program{    static void Main(string[] args)    {        Console.WriteLine("Hello World!");    }}

Run the program and you can see the console output Hello World! string.

Using the ASP. NET Core

Next we create a ASP.NET Core project to experience.
We choose to create an empty website, when the project is created, you will see two. cs files in the root directory, respectively, Program.cs and Startup.cs files.

A web ASP.NET Core site is run as a console application, and a web hosting program is created from the console to handle Web requests, similar to node. js, Golang, compared to a traditional ASP.

When we run this project, we open a browser that displays the string in the browser Hello world! .

. NET core installation and initial experience

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.