ASP. NET Core series "one" to build ASP.

Source: Internet
Author: User

Original: ASP. NET Core series "one" Build ASP. NET Core Project

Why use ASP.

NET Core just released at the time according to the introduction of a Little heart itch, Microsoft's urine sex are understand, new things bug too much, now 2.0 also released a long time, decided to study a bit.

ASP. NET core Official document https://docs.microsoft.com/en-us/aspnet/core/getting-started

ASP. NET Core has the following advantages:

    • Build a unified scenario for Web UI and Web APIs.
    • Integrates with modern client frameworks and development workflows.
    • Environment-based cloud-ready configuration system .
    • Built-in dependency injection .
    • Lightweight, high-performance , modular HTTP request pipeline.
    • Can be hosted on IIS, Nginx, Apache, Docker, or self-hosted in its own process.
    • When targeting to . NET Core , you can use concurrent application versioning.
    • Tools for simplifying modern Web development.
    • Ability to build and run on Windows, MacOS, and Linux.
    • Open source and community-centric .

I believe that a large part of the people because of the core cross-platform! Now let's start tossing.

New Project

To create a new project, we chose ASP. The most interesting thing is that the Core inherits Ng and react, and so on later.

Now focus on our MVC

Project Structure

The new project structure is largely different from the traditional MVC, still model-view-controllers

All CSS images and other files are placed under Wwwroot

Appsettings.json

In our previous ASP. NET MVC development, when it comes to configuration files, we don't think of web. config and App. Config, in the core we see a lot of changes, the new configuration system appears to be more lightweight, has better extensibility, and supports a variety of data sources.

For example: connection string, file upload path, etc...

1 {  2   "ConnectionStrings": {  3     "defaultconnection": "Data source=.; database=netcoreadmin;uid=sa;pwd=123456; Multipleactiveresultsets=true; " 4   }, 5   " Logging ": {  6     " LogLevel ":{  7       " Default ":" Warning " 8      }  9  }
Startup.cs

This is a very important part of MVC core, including loading configurations, loading components via dependency injection, registering routes, and so on.

Program.cs

Here is a very familiar main method, that is, the starting point of the application, starting with usestartup<startup> () to specify the following startup startup file

Summary

Now that the project is complete and running, you will be able to see the familiar hellow on the browser word!

ASP. NET Core series "one" to build ASP.

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.