CSS,Javascript和图像长度为零 [英] CSS, Javascript and Images have zero length

查看:105
本文介绍了CSS,Javascript和图像长度为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图端口一个ASP.NET MVC 1.0 / Visual Studio 2008的项目,ASP.NET MVC RC 2 / Visual Studio 2010中的项目是(而且一直)在IIS 7上运行。

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.

动态内容(这是由控制器提供的一切)工作正常,但静态内容,如CSS / JavaScript的/图片给了我一个200 OK响应,0内容长度,并没有任何内容。这是因为如果所有这些文件是完全空的(我确信这些文件不是空的虽然)。

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).

静态内容是我从通过IgnoreRoute ASP.NET路由排除了一个目录。

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

这不可能是一个隐藏的404错误,因为该URL产生络404错误增加了一些乱码。

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.

怎么可能是问题?

编辑:我刚刚创建了一个完全新的ASP.NET MVC网站从无到有,尝试运行在IIS。它具有完全相同的问题!所以它不是真的我的项目都转换为MVC2的问题,而似乎是IIS这是造成麻烦。但是,什么可能是这个问题?

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?

推荐答案

正如我刚才发现,问题是,控制面板 - > Windows功能 - >万维网服务 - >常见HTTP功能 - >静态内容不检查。有一次,我选中此,一切又工作得很好。

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.

这篇关于CSS,Javascript和图像长度为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆