无点文件在IIS中产生404错误 [英] Dotless File Yields 404 Error in IIS

查看:141
本文介绍了无点文件在IIS中产生404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功在我的开发Cassini服务器中使用 .less 文件(无数)几个星期但是当我发布到我的本地IIS服务器时,它们会产生404错误。将我的调试器附加到IIS不会产生任何异常。我也重新启动了我的IIS应用程序池和服务器。

I've been successfully using .less files in my dev Cassini server (with dotless) for a few weeks but when I publish to my local IIS server they yield 404 errors. Attaching my debugger to IIS yields no exceptions. I've restarted my IIS app pool and server as well.

任何想法?

推荐答案

看起来你在IIS上缺少mime类型。

Looks like you're missing a mime type on IIS.

对于IIS7,将以下内容添加到 web.config

For IIS7 add the following to your web.config:

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".less" mimeType="text/css" />
    </staticContent>
</system.webServer>

对于IIS6,你可以这样做(假设你有管理员RDP访问权限):

For IIS6 you can do (presuming you have administrator RDP access):

cscript adsutil.vbs set W3SVC/1/Root/MimeMap ".less, text/css"

其中 / 1 / 是网站的IIS编号。

Where /1/ is the IIS number of the site.

这篇关于无点文件在IIS中产生404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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