I'm trying to run the ASP.NET 5 MVC 6 sample "HelloMVC" project, with a custom CSS file.
I place my .css files in the wwwroot
folder, let's say in a styles
folder.
I then link to it in my _Layout.cshtml
with
<link rel="stylesheet" href="~/styles/mystyle.css" />
However, the style doesn't get rendered.
If I go to the URL of the expected file in my browser (let's say I'm running on port 12345, so I go to http://localhost:12345/styles/mystyle.css
, I'm greeted with a cheeky page (pure HTML) with a lightbulb and a smiley face that says "Your ASP.NET 5 application has been successfully started
".
In fact, if I go to any URL for the running app, I'm greeted with the same page. i.e. going to http://localhost:12345/thisfiledoesntexist.jpg
will return the same page.
Is this ASP.NET 5's current 404
page? Why aren't my styles getting rendered? I would think this would be a very simple thing.
Looking at this question it seems that what I'm doing would be the proper way. In fact, Visual Studio even has intellisense for the css files that I've added when typing out the href.
Aucun commentaire:
Enregistrer un commentaire