The.net Core is introduced
First of all,.net Core is not the same as ASP.NET Core..NET Core is an open source universal development platform. Based on.net Core, you can develop applications like ASP.net Core.
.NET Core also has the following features:
- Cross-platform: Runs on Windows, macOS, and Linux operating systems.
- Consistency across architectures: Running code with the same behavior across multiple architectures, including X64, x86, and ARM.
- Command-line tools: Includes easy-to-use command-line tools for local development and continuous integration solutions.
- Flexible deployment: can be included in an application or installed parallel user or machine scope. Can be used with Docker containers.
- Compatibility:.NET Core is compatible with the.NET Framework, Xamarin, and Mono through.NET Standard.
- Open Source:.NET Core is an open source platform under the MIT and Apache 2 licenses. .NET Core is a.NET Foundation project.
- Supported by Microsoft:.net Core is maintained by a strong Microsoft team.
What is ASP.NET Core
ASP.NET Core is a web framework created by Microsoft for building web applications, apis, and microservices. It uses common patterns such as MVC (Model-View-Controller), dependency injection, and a middleware request processing pipeline.
ASP.NET Core runs on Microsoft’s.net runtime library, similar to a Java virtual machine (JVM) or Ruby interpreter. Several languages (C#, Visual Basic, F#) can be used to write ASP.NET Core programs. C# is the most common choice, and of course most of my people develop in C#. You can build and run ASP.NET Core applications on Windows, Mac, and Linux.
ASP.NET Core also has the following advantages:
- A unified scenario for generating Web UI and Web API.
- Build for testability.
- Razor Pages can make page-based coding simpler and more efficient.
- Can be developed and run on Windows, macOS, and Linux.
- Open source and community-centric.
- Built-in dependency injection.
- Lightweight, high-performance, modular HTTP request pipeline.
- Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.
- Parallel application versioning can be used when.net Core is run.
Why use ASP.net Core to develop applications
There are many existing Web frameworks, such as Node/Express, Spring, Django, etc. But why develop applications with ASP.NET Core?
- Speed: ASP.NET Core is fast. Because.net Core is compiled and run, it performs much faster than languages that interpret execution, such as JavaScript or Ruby. ASP.NET Core has also been optimized for multithreading and asynchronous tasks. It’s not unusual for code to execute 5-10 times faster than code written in Node.js.
- Ecology: ASP.NET Core may be in its infancy, but.net is proven. There are thousands of packages on NuGet (.NET’s package management system like NPM, Ruby Gems, or Maven). There are ready-made packages for JSON deserialization, database connectivity, PDF generation, or just about anything you can think of.
- Security: the Microsoft development team takes security very seriously, and ASP.NET Core has been secure since its inception. It already handles automatically the purification of input data and cross-domain forgery requests (CSRF). You also have the advantage of the.NET compiler’s static typing, which is like a vigilant, obsessive reviser. In this way, when using a variable or certain data, you are vulnerable to unintended errors.
- Cross-platform: Can run on Windows, Mac, or Linux with.net runtime libraries installed.
- Open Source:.NET Core is open source (MIT license). May be freely adopted by individuals and enterprises, including for personal, academic or commercial purposes. Open source also means that when you have a problem you can read the source code and get a solution.
NET Core environment construction
- Search for.NET Core on Google or any other browser, and the first one is Microsoft’s official download address, or click hereDownload .NETDownload the SDK for development and the Runtime for deployment.
- Double-click on the SDK you downloaded and install it step by step stupidly.
- And then hold
Shift+ right mouse button
And then select “Open Powershell window here” or “Open command line window here”. Then enterdotnet --info
Take a look at what we’ve installed. The.net Core development environment is ready for you. The.net Core development environment is ready for you. The.net Core development environment is ready for you.
Quickly create an ASP.net Core project to practice
1. Step 1: Open VS2019 and click “Create a new Project “.
2. Select the ASP.net Core Web application and click Next. To change the project name, click “Create”.
3. The target framework (.NET Core or. NET Framework), next you can create an empty solution or create a Web project with a template, we chose MVC Web application.
4. After successful creation, there is a standard MVC structure as follows.
- Wwwroot: the static file directory of the website
- Appsettings. json: configuration files, such as database connection strings and other configuration information.
- Program.cs: Program entry file (which contains a Main method);
- Startup.cs Startup configuration file;
- -Leonard: Controllers.
- Entity Models:
- Views: view
5. Press F5 of the keyboard or click the “Run” button as shown below.
6. If nothing goes wrong, it will display the interface shown below. At this point we have an ASP.net Core MVC site running. If error 500.24 is reported, please refer to this link