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?

4
  • Can you post your web.config or possibly give us an external url we can see? Commented Feb 21, 2010 at 12:09
  • The problem does not seem to be related to this specific project at all. See my edit above. Commented Feb 21, 2010 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? Commented Feb 21, 2010 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 Commented Feb 21, 2010 at 15:14

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

+1 for providing the answer, and for Commong because I was afraid I was the only one who ever made that typo.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.