10

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?

Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
  • Can you post your `web.config` or possibly give us an external url we can see? – Nick Craver Feb 21 '10 at 12:09
  • The problem does not seem to be related to this specific project at all. See my edit above. – Adrian Grigore Feb 21 '10 at 12:47
  • You shouldn't need to Ignore the directory for the static content - it kinda should just be clever enough to display it. Have you tried without the extra ignore rule in it and if that works? – Amadiere Feb 21 '10 at 13:12
  • As described in the edit, this problem is not at all related to my project. It even occurs with a brandnew asp.net mvc project, no changes applied. So the fault must be somewhere in the IIS configuration – Adrian Grigore Feb 21 '10 at 15:14

1 Answers1

21

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.

Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
  • +1 for providing the answer, and for `Commong` because I was afraid I was the only one who ever made that typo. – Joseph Yaduvanshi Feb 21 '10 at 16:24
  • 1
    On Windows 10 is Control Panel -> Programs -> Turn Windows Features on and off -> Internet Information Services -> World Wide Web Services -> Common HTTP Features -> Static Content – Teejay Sep 24 '20 at 09:29