ASP. NET Core static File Usage tutorial (9), asp. netcore
In this chapter, we will learn how to use files. Almost every web application requires an important feature: providing files (static files) from the file system ).
Static files such as JavaScript files, images, and CSS files can be directly provided to custo
environment:os name:centos OS Version:7OS platform:linux Rid:centos.7-x64 Base Path:/usr/share/dotnet/sdk/2.1.101/Microsoft. NET Core Shared Framework Host Version:2.0.6build:74b1c703813c8910df5b96f304b0f2b78cdf194dThis allows the. NET core2.1 environment to be installed.2, the installation of Supervisor service.This
the program, followed by the parameter.
Building projects
Docker build.View the build-completed image, where the image ID is the identifier for building the completed imageDocker imagesGive the image a name.Docker tag {IMAGE ID} qinnz/wukongLittle TricksMirroring is equivalent to a container's negatives, and we can create many identical containers with mirrors.Let the true and False Monkey King at the same time to run ASP.Well, you already have an image that needs to be
Entry
New ASP. NET Https://www.cnblogs.com/Leo_wl/p/5654828.html
Deploy your ASP. NET Core project on IIS https://www.cnblogs.com/wangjieguang/p/core-iis.html
For example, let's talk about its dependency injection
each part, each stage of the demo to download to everyone, in fact, if you finish, and eliminate my Code is not good place, you do not need these demo, is it ~Index"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing, doing projects (1) building an MVC environment registration area"Selfless sharing: from getting started to
Index"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing, doing projects (1) building an MVC environment registration area"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with
version in CMD when you are finished.
Change 1: added a new command as indicated by the arrow.
dotnet New razordotnet New nugetconfigdotnet new pagedotnet new viewimportsdotnet new Viewstart
These new CLI commands are added. Where Viewimports,viewstart is the _xxx.cshtml two files in the Razor view.
Change 2: dotnet new xxx will automatically restore the NuGet package without you having to re-dotnet the restore command again.
G:\Sample\ASPNETCore2
middleware, we also registered the corresponding middleware by calling other extension methods to achieve access to static files (UseStaticFiles), error page rendering (UseExceptionHandler), and ASP-based.. NET Identity Framework (UseIdentity ).
1: publicclass Startup
2: {
3: publicvoid Configure(IApplicationBuilder app)
4: {
5: app.UseExcepti
ASP. NET Core exception and error handling (8), asp. netcore Processing
In this chapter, we will discuss exception and error handling. When errors occur in ASP. NET Core applications, y
Run ASP. NET Core Web API application and dockerapi in docker
This article describes how to run an ASP program in docker. the basic steps of the NET Core Web API application are described in brief. Many articles on the Internet ha
. NET Core 2.0 and ASP 2.0 official first-edition early-Experience. NET Standard 2.0 are finalBroad platform Support. . NET Standard 2.0 are supported on the following platforms:
. NET Framework 4.6.1
.
vs tool. For more information, see here. Next we will create an Asp. NET Core demo application.
Open Visual Studio to create a project, and select Web-> ASP. NET Core Web Application (. NET
Get ([PageNumber] int p = 1, int size = 5) {var values = new [] {"a", "B ", "c", "d", "e", "f", "g", "h", "I", "j", "k", "l ", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v ", "w", "x", "y", "z"}; var skip = (p-1) * size; var take = size; var records = values. length; var pages = (records + size-1)/size; return OK (new PagedResult (values. skip (skip ). take (take), p, size, records, pages ));}We use PageNumberAttribute to specify the parameter p as the paging parameter. when accessing data o
) { //execute once to register the eventUrlrewrite URL =NewUrlrewrite (); Url. Init (System.Web.HttpApplication.Instance); Appconfig.webrootpath= env. Webrootpath;//to set the root address, the root directory of Aspnetcore is not the same as other applications. returnBuilder. Usemiddleware(); } }}The specific code is divine code meaning, do not explain, understand. NET Core
vs tool. For more information, see here. Next we will create an Asp. NET Core demo application.
Open Visual Studio to create a project, and select Web-> ASP. NET Core Web Application (. NET
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.