11

Is there a way to serve unknown file types in IIS 7?

I only want to do this for a single directory where execution is turned off and everything will be served as a static file.

As it is now, I have to add each file extension that I want to serve as a MIME type. I want to serve everything. How can this be done?

Ronnie Overby
  • 681
  • 2
  • 12
  • 24

3 Answers3

15

You can add an universal MIME type by using the extension "*" and the type "application/octet-stream": http://support.microsoft.com/kb/326965

Massimo
  • 68,714
  • 56
  • 196
  • 319
  • 1
    Click MIME Types. Click New. In the Extension box, type an asterisk (*). In the MIME Type box, type `application/octet-stream` – emirjonb Oct 30 '15 at 08:36
6

Instead of going through the MMC like the kb article suggests, you can also just create a Web.config file in the directory, with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".*" mimeType="application/octet-stream" />
        </staticContent>
    </system.webServer>
</configuration>
Xavier
  • 269
  • 3
  • 9
3

Just in case pictures help. This is for IIS v10 installed on a windows 10 box:

  1. Go to MIME Types feature of the virtual directory of your website:

enter image description here

  1. Set up the asterisk based mime type to support unknown file types:

enter image description here

RBT
  • 223
  • 2
  • 10