IIS6提供未注册的MIME类型 [英] IIS6 serving unregistered MIME Types

查看:77
本文介绍了IIS6提供未注册的MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台IIS6 Web服务器(在Win2003上)有一种奇怪的行为,我猜这是一些未记录的功能" ...

I have an IIS6 web server (on Win2003) is having a strange behavior which I guess is some undocumented "feature" ...

它提供SVG文件(扩展名.svg),而无需在IIS配置数据库中注册.它也不具有* mime类型.

It serves SVG files (extension .svg) without having it registered on the IIS metabase. It does not have the * mime type either.

对于此请求:

GET /basic/file1.svg HTTP/1.1

响应包含

HTTP/1.1 200 OK
Content-Length: 32817
Content-Type: image/svg+xml

那么... IIS在哪里得到这种image/svg+xml MIME类型?

So ... where does IIS got this image/svg+xml mime type?

我找到它的唯一位置是注册表中的HKEY_CLASSES_ROOT\MIME\Database. 但是根据我发现的所有MS信息,IIS允许的mime类型的来源是它自己的元数据库.

The only place I found it is in Registry, at HKEY_CLASSES_ROOT\MIME\Database. But according to all the MS information I found, the source for IIS allowed mime types is it's own metabase.

有人知道这种行为吗?这可能导致IIS管理员产生错误的安全感...

Does anyone know this behavior? This could lead a IIS admin to a false sense of security...

最诚挚的问候!

推荐答案

IIS合并配置数据库和注册表中的MIME映射(HKCR \< extension>)以获取允许的Mime类型列表.

IIS merges MIME maps from the Metabase and the registry (HKCR\<extension>) to get the list of allowable Mime Types.

要列出配置数据库的mime时间,可以使用:

To list the metabase mime times, you can use:

adsutil.vbs get /MimeMap/mimemap

不幸的是,这打印出的哑剧图效果很差:

Which, unfortunately, prints out the mime map poorly:

D:\Apps\Scripts>adsutil.vbs get /MimeMap/mimemap
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

MimeMap                         : (MimeMapList) ".asx,video/x-ms-asf" ".xml,text/xml" ".tsv,text/tab
-separated-values" ".ra,audio/x-pn-realaudio" ".sv4crc,application/x-sv4crc" ".spc,application/x-pkc
s7-certificates" ".pmc,application/x-perfmon" ".lit,application/x-ms-reader" ".crd,application/x-msc

在ADSUtil.VBS中更改一行可解决此问题(请注意"vbCRLF&"):

Changing one line in ADSUtil.VBS fixes this (note the " vbCRLF & ") :

第1655行:

        MimeOutPutStr = MimeOutPutStr & """" & MimeEntry.Extension & "," & MimeEntry.MimeType & """ "

        MimeOutPutStr = MimeOutPutStr & vbCRLF & """" & MimeEntry.Extension & "," & MimeEntry.MimeType & """ "

产生这样的输出:

D:\Apps\Scripts>adsutil.vbs enum  /MimeMap
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

KeyType                         : (STRING) "IIsMimeMap"
MimeMap                         : (MimeMapList)
".asx,video/x-ms-asf"
".xml,text/xml"
".tsv,text/tab-separated-values"
".ra,audio/x-pn-realaudio"
".sv4crc,application/x-sv4crc"
".spc,application/x-pkcs7-certificates"
".pmc,application/x-perfmon"
".lit,application/x-ms-reader"
".crd,application/x-mscardfile"

这篇关于IIS6提供未注册的MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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