IIS 7 and Media Files 404.3 Error

By Akbar

When working a new site content changes, we decided to add a new media files (of MP4) type. For playing this video file directly from the website, we decided to use the VideoJS Player.

Everything worked fine on the development machine (using IIS 6.0). However, when we deployed this to the Dev server machine using the IIS 7.5 and ASP.Net 2.0, we were getting the following server error when accesing the file:
HTTP Error 404.3 – Not Found

On server local machine, the detail of the error was:
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

So I know this has to do something with the file mapping. And sure enough, when I googled this, I found that in IIS 7.0 and 7.5, for the static content files, you need to define the supported types in the web.config. So, to make it all work, we just had to add the following in the web.config file:

1
2
3
<staticContent>
	<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>

This should go under the system.webServer tag.

I think it’s a nice security feature introduced by IIS 7.0, but having not used this before got me in a little trouble. Anyway, the lesson learned and documented.

Tags: , ,