IIS不提供静态内容(css / js / images等)404 [英] IIS not serving static content (css/js/images, etc) 404

查看:302
本文介绍了IIS不提供静态内容(css / js / images等)404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • 创建项目(在这种情况下,它只是使用$ b的空web应用程序
  • 编辑hosts文件以允许自定义URL(local.xxx-xxx.com) 创建IIS网站和应用程序池指向local.xxx-xxx.com和
    选择启动目录。

  • 编辑根文件夹的权限以允许IIS_IUSRS和NETWORK
    SERVICE能够访问文件。


    我已进入IIS检查Windows功能中是否选中了静态内容复选框,它是。

    我没有看到什么?





    另外,例如,当我浏览到





    元素的元素为静态内容类型的集合添加一个唯一的MIME类型。每个条目必须由两部分组成:


    由fileExtension
    属性指定的唯一文件扩展名,例如, .txt,.png等。文件
    名称扩展名的MIME类型,由mimeType属性指定,例如
    例如text / plain,image / jpg等等。

    参考资料


    I have done this 1 million times....

    • Create project (in this case it's empty web application using only HTML files).
    • Edit hosts file to allow custom URL (local.xxx-xxx.com)
    • Create IIS website and app pool to point to local.xxx-xxx.com and choose start directory.
    • Edit permissions on root folder to allow IIS_IUSRS and NETWORK SERVICE to be able to access files.

    I've gone into IIS to check if "Static Content" checkbox was checked in "Windows Features", and it is.

    What am I not seeing?

    Also, for example, when I browse to "http://local.xxx-xxx.com/source/sass/main.min.css" I get:

    HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    解决方案

    IIS will not return file types that are not added to the element or that have mappings in the element by default. This behavior prevents unauthorized access to files that do not have mappings in the IIS 7 configuration settings.

    The element of the element adds a unique MIME type to the collection of static content types. Each entry must consist of two parts:

    A unique file name extension that is specified by the fileExtension attribute, for example, ".txt", ".png", etc. A MIME type for the file name extension that is specified by the mimeType attribute, for example, "text/plain", "image/jpg", etc.

    Reference

    这篇关于IIS不提供静态内容(css / js / images等)404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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