Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# ASP.NET MVC Basics Views View Layouts

Jacob Dillson
Jacob Dillson
2,932 Points

My static files seem to not be rendered when the IIS is running....

I am currently running the .NET Core 1.0.1 and the default route for static files (i.e. css, js, e.t.c) are supposed to be under the wwwroot folder. For some reason even if I have my static files in there they do not render when the action method is called. Can anyone give me a possible explanation?

Thanks in advance...

1 Answer

Jacob Dillson
Jacob Dillson
2,932 Points

Problem solved, in your Dependencies folder right-click and go to Manage Nuget Packages. From there you need to download "Microsoft.AspNetCore.StaticFiles".

That will automatically add it to the .csproj file if you are used to manually adding the Package Reference

After that you need to go into your Startup.cs file and add the following code snippet into your Configure method:

     app.UseStaticFiles();

Hopefully this was helpful, the link below is to the video I followed to fix the issue I was having.

https://www.youtube.com/watch?v=n3rL0ekYEOM

Special thanks to Ugo Lattanzi for the helpful video!