Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing static content of an ASP.Net MVC project with IIS7

I've create a web site on my local IIS 7 with my own ASP.Net MVC project on its root.

Everything is working fine except for the static content. Going to http://localhost:8080/Content/Site.css gives me a 404. I can see the folder on IIS Manager.

The content is served fine with the small development server you get when you run the application on Visual Studio 2008. Any ideas what might be wrong?

like image 501
pupeno Avatar asked Jun 23 '09 10:06

pupeno


3 Answers

The problem was permissions. Even though when I create the IIS7 web site I told it to access the files as my user (it wouldn't work at all otherwise), for static file it was using the user of the application pool. Giving access to IIS APPPOOL\MyApplication to the folder where my project was fixed the issue.

like image 109
pupeno Avatar answered Nov 10 '22 14:11

pupeno


How about

routes.RouteExistingFiles = true;

in your Global.asax?

like image 3
chris166 Avatar answered Nov 10 '22 12:11

chris166


Try going to http://localhost:8080/../../Content/Site.css, not sure if your original URL is matching a route.

Not really a programming question though.

like image 1
Lazarus Avatar answered Nov 10 '22 13:11

Lazarus