Set up a web server (a) http server with dotnet core


Environment Description

dotnet core, the development needs to be installed dotnetcore sdk, run need to install dotnetcore runtime

Run currently supports almost all popular platforms

Recommended windows10 development platform

Help install IDE vs2019 and windows, attention is not code, although dotnet core can use the command line to complete all operations, but can provide an IDE is still very much developing efficiency is justice.

dotnet core requires a separate installation

https://dotnet.microsoft.com/download/dotnet-core/3.0

Development needs to be filled SDK

image

The machine is running only need to install the runtime


First, create a project


We use netcore console project as a server process


You can use the command line

dotnet new console

Or create an interface with the ide

image


Second, the installation package microsoft.aspnetcore.app

nuget package is a service provided by Microsoft, anyone can upload to the above package

Package is a set of dll and resources.

Do not need to carry all use when publishing software package, the other can be configured according to the project to restore

Installation package

1 can use the command line

image

2. Right-nuget package or project manager

image

To install a package

3. You can also modify the file directly csproj

image


We want to establish an independent http server process, simply install this package

Microsoft.AspNetCore.App

This package is not the only option for establishing http server process, but he is Microsoft's official, full-featured, why not.

Recovery Kit

1. Use the command line

dotnet restore


2.VS the GUI Solution Right nuget reduction package

image

Sometimes open solution package there exclamation point, build is not passed, will restore some package

By git general management, ignores nuget directory, everyone grab yourself by the recovery package, nuget directory is usually in the System folder

Third, the most simple http program

image

running result

image

Code location

https://gitee.com/lightsever/netcore_study/tree/master/server01_basic

Guess you like

Origin www.cnblogs.com/crazylights/p/11888312.html