从 IE 下载 Docx - 在 IIS 中设置 MIME 类型 [英] Downloading Docx from IE - Setting MIME Types in IIS
问题描述
我相信这个问题有一个简单的答案.
I am sure there is a simple answer to this one.
我有一个 docx 文件,尝试下载时出错(找不到文档).....doc 很好,.txt 也很好.我确定这只是一个 iis 设置,服务器上的所有文件的权限都相同.
I have a docx file that I get an error when trying to download(document cannot be found).... .doc is fine .txt is also fine. I am sure this is just an iis setting, the permissions on the server are all the same for all files.
推荐答案
是的,这只是一个 IIS 设置:默认情况下,它将只提供扩展名与定义的 MIME 类型相匹配的文件.
Yes, it's just an IIS setting: by default, it will only serve files for which the extension matches a defined MIME type.
要允许下载 .docx 文件,请按照上面链接的知识库文章中的步骤操作:
To allow .docx files to be downloaded, follow the steps from the KB article linked above:
- 打开 IIS Microsoft 管理控制台 (MMC),右键单击本地计算机名称,然后单击属性.
- 点击 MIME 类型.
- 点击新建.
- 在扩展名"框中,键入所需的文件扩展名(在本例中为 .docx).
- 在 MIME 类型框中,输入 application/vnd.openxmlformats-officedocument.wordprocessingml.document (感谢@web 开发人员指出此 MIME 类型,它取代了我原来答案中的application/msword").
- 应用新设置.请注意,您必须重新启动万维网发布服务或等待工作进程回收以使更改生效.在此示例中,IIS 现在提供扩展名为 .docx 的文件.
请注意,知识库文章使用通用的 application/octet-stream MIME 类型:虽然这通常应该有效,但如果存在更具体的 MIME 类型,例如 application/msword,则最好使用它.
Note that the KB article uses the generic application/octet-stream MIME type: although that generally should work, if a more specific MIME type exists, such as application/msword, it's always best to use that.
这篇关于从 IE 下载 Docx - 在 IIS 中设置 MIME 类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!