Petes techie blog

A blog written for two people. Me and You.

Mime Types on IIS7

| Comments

I host quite a few mp4 videos on our webserver which runs IIS7. By default, IIS7 doesnt have the mime type set for mp4 and thus returns an error of 404 if you try to access the file. This is done for security reasons (so people cant access secure files by default eg .inc, .cs etc). Thats a valid point but mp4 is quite common as a format especially these days so why isnt that one made available?! Anyway, in IIS7 I came across quite a nice solution, you can additional mime types to the web.config. Here is a sample:

1
2
3
4
5
6
<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
    </staticContent>
</system.webServer>

I like that, if we ever move to another server thats one less thing to have to remember to set up.