VNext MVC Template - wwwroot

I created a vNext MVC Template, then created a folder called images under wwwroot. I call it:

<img src="~/wwwroot/images/album/1.jpg" /> 

But the image does not load. How can I achieve this image?

+6
source share
1 answer

Put this as an answer with more details so others can see.

The wwwroot folder in the application is the root of the static, served files. This way wwwroot not displayed in the urls. Take a look at the project.json file to see where this comes into play:

 { ... "webroot": "wwwroot", ... } 

This tells ASP.NET vNext that static files ("webroot") are in the wwwroot subdirectory. This is the default location where static file middleware will return files.

+4
source

Source: https://habr.com/ru/post/978187/


All Articles