Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS returns 404 not found for .mp4 files

I used hmtl video tag to play video . In my localhost video plays but when I published . It is not played.I have created project based on in ASP.NET. I locally use like this method.

http://localhost:41563/files/Just.mp4

and When I published the url give me an error like this:

  http://111.111.22.22:41563/files/Just.mp4

404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

How can I solve this.

like image 888
mehmet Avatar asked Feb 02 '15 09:02

mehmet


People also ask

How do I fix 404 file or directory not found IIS?

Try removing the binding and browse from the server itself(through the IIS console) to see if the application opens. Default document for my ASP . net web app is set in IIS to "Default.

How do I fix file 404 error not found?

The simplest and easiest way to fix your 404 error code is to redirect the page to another one. You can perform this task using a 301 redirect. What's 301, you may ask? It's a redirect response code that signals a browser that the content has been transferred to another URL.

Why am I getting 404 file or directory not found?

The 404 File or directory not found error can be caused due to a few factors such as incorrect file name, cookies, and cache being populated, large file size or browser incompatibility.


2 Answers

Check if you have IIS MIME Type for mp4 added for hosted site (or for the directory where you have your video files).

For the Win Server 2012 is is already there but for Win Server 2008 it is not included by default.

So, if you developed/tested on WinSer2012 and then deployed on WinSer2008 then you can have this issue.

The mp4 MIME settings are: File name extension: .mp4 MIME type: video/mp4

like image 182
Eugene Avatar answered Oct 01 '22 07:10

Eugene


The MIME type can be added via Web.config as well, just in case your IIS is on Azure:

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

https://blogs.iis.net/bills/how-to-add-mime-types-with-iis7-web-config

like image 45
Ram Avatar answered Oct 01 '22 07:10

Ram