Search code examples
asp.netiismime

How to enable IIS to serve extension through web.config


I'm having some trouble with a website on a webhotel. It will not serve *.mp4 files - I simply get error 404.

Had I access to the server I'd add the mimetype in IIS, however I haven't :-(

The webhotel said they wouldn't customize their IIS for one customer, so I should enable it in my web.config instead.

Now my question is: how do I do this ?

I'm aware of the FileExtensions tag, but its default behaviour is to allow all extensions, so I doubt that's what they meant.

They're a bit slow to elaborate on these kinds of things, therefore I ask here :-)


Solution

  • <configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        </staticContent>
    </system.webServer>
    </configuration>
    

    Obviously, don't repeat any sections that are already in your web.config just add the children in the appropriate places.