I encountered a strange error today while I was developing a document repository website in a Windows Server/IIS environment. When I pointed my browser at myfile.docx it returned a 404 error, but other files in the same directory were served correctly. After some Googling, I discovered that Microsoft’s IIS only allows the download of files that are in a list of predefined types as a security measure. To be able to download Office 2007 files from IIS you need to add the extension/MIME type pairs to the IIS configuration.
There are 2 ways to achieve our goal of accessing Office 2007 files via the browser:
Add the Office File Extensions in IIS
- Open IIS
- Right-click on the website profile and select Properties from the menu
- Goto the HTTP Headers tab
- Click on the MIME Types button at the bottom of the dialog
- Click New
- Add the File Extensions and MIME Types you require from the list at the bottom of this post
or alternatively, you can
Edit the Metabase Configuration File
- Stop IIS
- Open C:/Windows/system32/inetsrv/metabase.xml
- Search for
IIsMimeMap
- Add the list of MIME types below to the end of the list
- Restart IIS
Office 2007 Document MIME Types
.docm,application/vnd.ms-word.document.macroEnabled.12 .docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document .dotm,application/vnd.ms-word.template.macroEnabled.12 .dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template .potm,application/vnd.ms-powerpoint.template.macroEnabled.12 .potx,application/vnd.openxmlformats-officedocument.presentationml.template .ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12 .ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12 .ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow .pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12 .pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation .xlam,application/vnd.ms-excel.addin.macroEnabled.12 .xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12 .xlsm,application/vnd.ms-excel.sheet.macroEnabled.12 .xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xltm,application/vnd.ms-excel.template.macroEnabled.12 .xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template
Source: therightstuff.de