Here are the steps to serve static files in our ASP.NET Core application.
1. Open the "NorthwindCafe.Web" project, then click on the "Startup.cs" file in the project. You will see the following markup in the Configure method
public void Configure(IApplicationBuilder app) { app.Run(async (context) => { await context.Response.WriteAsync("Hello World!"); }); }
2. Go into the Configure method, remove the existing code and type in the following code
public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); }
You will notice that the app.UseStaticFiles() has a red underline on it. That's because there's a dependency that we are missing. Visual Studio is smart enough to detect that and give us a warning. You will see a yellow light bulb icon next to "app.UseStaticFiles()"
3. Click on the light bulb and select the first option which will add the namespace to the project and will automatically, once the file is saved.
ASP.NET Core Posts:
- How To Create An ASP.NET Core Application From Scratch
- ASP.NET Core : Add jQuery, Bootstrap, AngularJS Using bower.json
- Enable MVC On ASP.NET Core Application
- ASP.NET Core : Create Our First Controller and View
- ASP.NET Core : Adding The Default View With _ViewStart.cshtml
- ASP.NET Core : Create A Responsive Layout With Bootstrap
- ASP.NET Core : Adding Font-Awesome For Northwind Cafe Navigation Icons
- ASP.NET Core : Add .json Configuration Files With Microsoft.Extensions.Configuration Library
- ASP.NET Core : Entity Framework Core Models For Northwind Cafe
- ASP.NET Core : Create The NothwindContext ( EntityFrameworkCore )
- ASP.NET Core : Configure project.json File To Support Entity Framework Core
- ASP.NET Core : Add NorthwindContext To Startup Class And Create Database
- ASP.NET Core: Seeding The NorwindCafe Database
- ASP.NET Core: Add Logging To The NorthwindCafe Application
Mua vé tại Aivivu, tham khảo
ReplyDeleteVé máy bay đi Mỹ
mua vé máy bay từ mỹ về việt nam hãng eva
khi nào có chuyến bay từ đức về việt nam
vé máy bay từ việt nam sang nga bao nhiêu
các chuyến bay từ anh về việt nam
mua vé máy bay giá rẻ từ pháp về việt nam
Chuyen bay cho chuyen gia nuoc ngoai