iis7默认的mime类型行为(iis7 default mime type behavior)

因此,在IIS 7中,如果某个扩展名没有特定的MIME定义,即使您可以在目录列表中看到它,它也将拒绝提供它(404)。 我确定这是一个相当已知的问题,但有没有办法通配符或为未知文件类型设置默认操作? 我希望默认情况下可以下载所有内容,就像我使用的其他所有网络服务器一样。

So in IIS 7 if there is no specific MIME definition for a certain extension, it will refuse to serve it (404) even if you can see it in a directory listing. I'm sure this is a fairly known issue, but is there a way to wildcard or set a default action for unknown file types? I want everything to be offered for download by default like with every other webserver I've used.

最满意答案

为扩展名为*文件添加一个新的MIME类型,其类型为application/octet-stream 。 这将为没有一个文件的所有文件提供默认的MIME类型,并绕过阻止。

然而,风险是您最终共享机密数据库,配置文件等等,因此在打开服务器到所有下载之前,请确保您知道自己在做什么。

Add a new MIME type for files of extension * with a type of application/octet-stream. This will provide a default MIME type for all files that don't have one and bypass the blocking.

The risk, however, is you end up sharing your confidential database, configuration files and whatnot, so make sure you know what you are doing before you open your server to all downloads.

更多推荐