从IE下载Docx - 在IIS中设置MIME类型 [英] Downloading Docx from IE - Setting MIME Types in IIS

查看:263
本文介绍了从IE下载Docx - 在IIS中设置MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确信这个答案很简单。

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:


  1. 打开IIS Microsoft管理控制台(MMC),右键单击本地计算机名称,然后单击属性。

  2. 单击MIME类型。

  3. 单击新建。

  4. In在扩展名框中,键入所需的文件扩展名(在本例中为.docx)。

  5. 在MIME类型框中,键入application / vnd.openxmlformats-officedocument.wordprocessingml.document (感谢@web开发人员指出这个MIME类型,它取代了原来答案中的'application / msword'。)

  6. 应用新设置。请注意,必须重新启动World Wide Web Publishing服务或等待工作进程回收才能使更改生效。在此示例中,IIS现在提供扩展名为.docx的文件。

  1. Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties.
  2. Click MIME Types.
  3. Click New.
  4. In the Extension box, type the file name extension that you want (in this case, .docx).
  5. In the MIME Type box, type application/vnd.openxmlformats-officedocument.wordprocessingml.document (thanks to @web developer for pointing out this MIME type, which supercedes the 'application/msword' from my original answer).
  6. Apply the new settings. Note that you must restart the World Wide Web Publishing Service or wait for the worker process to recycle for the changes to take effect. In this example, IIS now serves files with the .docx extension.

请注意,知识库文章使用通用应用程序/八位字节流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屋!

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