Enable IIS Server to Serve .mp4 files through web.config file
Now, most of the websites are being developed using HTML5 and using videos on the background is an easy job using the video tag.. It is advised to serve video files using a CDN, however, in case you want to host videos from your own server, you need to configure IIS to server .mp4 files. In case you don’t configure it, you will get a 404 error or an error saying “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.” Again, if you have got access to IIS , it’s a great thing but what if you’re hosting the website on a shared server where you don’t have access to IIS Server. In this post, we will see how can we enable IIS Server to serve .mp4 files through web.config file.
To allow IIS to server files, we need to configure proper mimeType for the required files. The mimeType for a .mp4 is video/mp4. Just add the following line in your web.config file under system.webServer tag and you should be good to go.
Once you do the above changes, your web server should start serving .mp4 files without issues.
Hope this post helps you! In case you know other ways of doing the same, do let me know via comments. Cheers!