Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS, Javascript and Images have zero length

I'm trying to port an ASP.NET MVC 1.0 / Visual Studio 2008 project to ASP.NET MVC RC 2 / Visual Studio 2010. The project is (and has always been) running on IIS 7.

Dynamic content (everything that's being delivered by controllers) works fine, but static content such as CSS / Javascript / Images gives me a "200 OK" response, a Content-Length of 0 and no content. It's as if all those files were entirely empty (I made sure the files are not empty though).

The static content is in a directory that I excluded from ASP.NET routing via IgnoreRoute.

It can't be a hidden 404 error since adding some garbage characters to the URL produces a reguar 404 error.

It doesn't seem to be related to filesystem permissions since I've already given everyone full access rights in the contents directory.

What could possibly be the problem?

Edit: I just created a completely new ASP.NET MVC website from scratch and tried running that in IIS. It has exactly the same problem! So it's not really a problem of converting my project to MVC2 at all, it rather seems to be IIS that's causing the trouble. But what could possibly be the problem?

like image 611
Adrian Grigore Avatar asked Feb 21 '10 11:02

Adrian Grigore


1 Answers

As I just found out, the problem was that Control Panel -> Windows Features -> World Wide Web Services - > Common HTTP Features -> Static Content was not checked. Once I checked this, everything worked fine again.

like image 86
Adrian Grigore Avatar answered Sep 22 '22 05:09

Adrian Grigore