ASP.NET MVC 6 (vNext) does not properly bind to files

I am trying to start an ASP.NET 5 MVC 6 HelloMVC project using a special CSS file.

I place the .css files in a folder wwwroot, say in a folder styles.

I then refer to it in his _Layout.cshtmlwith

<link rel="stylesheet" href="~/styles/mystyle.css" />

However, the style is not displayed.

If I go to the URL of the expected file in my browser (let's say I work on port 12345, so I go to http://localhost:12345/styles/mystyle.css, I am greeted by a sassy page (pure HTML) with a light bulb and an emoticon that says " Your ASP.NET 5 application has been successfully started".

In fact, if I go to any URL to launch the application, I am greeted with the same page. those. going to http://localhost:12345/thisfiledoesntexist.jpgwill return the same page.

Is this ASP.NET 5 page current 404? Why are my styles not showing? I would think that it will be a very simple thing.

Looking at this question , it seems that what I am doing will be right. In fact, Visual Studio even has intellisense for the css files that I added when I entered href.

+4
source share
1 answer

Removing app.UseWelcomePage();from Startup.csfixed according to Sami Kuhmonen's suggestion (and useful link at https://github.com/aspnet/Home/issues/113 )

+4
source

All Articles