Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!