Why the error 404 happens when I access *.mp4 file

2019-02-07 22:08发布

问题:

I have some shared folder over HTTP. Lets say: http://myserver/files

And there are some filed like png, avi, jpg, mp4 and etc.

I can easily access *.png or *.avi via browser (http://myserver/files/555.avi) but cannot access to *.mp4.

So IIS gives the 404 error.

What's up?

Thank you!

UPDATES:

May be it is important: I have to access by this URL format

http://112.333.44.33/files/555.mp4

回答1:

So I found the solution.

I just added correct MIME type to my website.

Extension: mp4

MIME type: video/mpeg

And now it works fine.



回答2:

Add a MIME type with extension mp4 in IIS

But please note that you should set the MIME type video/mp4 instead of video/mpeg orelse in IE "Save Target As.." shows different format, and it also affects the default video player open by browser.

video/mpeg

File name: test.mpeg

Save as type: Movie Clip

video/mp4

File name: test.mp4

Save as type: MP4 Video



回答3:

I just had that issue, and I compared my IIS10 (win10) and IIS 7.5 (win2008 R2) applicationhost.config files, and these are the changes I sent from iis10 to iis75.

29 new types, and 5 modified.

Watch out for .ts if you use typescript... ts was a video file before being a programming language file

<!-- new types -->
<mimeMap fileExtension=".3g2" mimeType="video/3gpp2" />
<mimeMap fileExtension=".3gp2" mimeType="video/3gpp2" />
<mimeMap fileExtension=".3gp" mimeType="video/3gpp" />
<mimeMap fileExtension=".3gpp" mimeType="video/3gpp" />
<mimeMap fileExtension=".aac" mimeType="audio/aac" />
<mimeMap fileExtension=".adt" mimeType="audio/vnd.dlna.adts" />
<mimeMap fileExtension=".adts" mimeType="audio/vnd.dlna.adts" />
<mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
<mimeMap fileExtension=".dvr-ms" mimeType="video/x-ms-dvr" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".jsonld" mimeType="application/ld+json" />
<mimeMap fileExtension=".less" mimeType="text/css" />
<mimeMap fileExtension=".m2ts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".m4a" mimeType="audio/mp4" />
<mimeMap fileExtension=".m4v" mimeType="video/mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".mp4v" mimeType="video/mp4" />
<mimeMap fileExtension=".oga" mimeType="audio/ogg" />
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
<mimeMap fileExtension=".spx" mimeType="audio/ogg" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
<mimeMap fileExtension=".ts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".tts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<mimeMap fileExtension=".wtv" mimeType="video/x-ms-wtv" />

<!-- modified types -->
<mimeMap fileExtension=".avi" mimeType="video/avi" />
<mimeMap fileExtension=".cab" mimeType="application/vnd.ms-cab-compressed" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".ics" mimeType="text/calendar" />
<mimeMap fileExtension=".js" mimeType="application/javascript" />



回答4:

I just found the cause of the issue in my cpanel who give me this 404 on mp4 problem maybe is useful for someone, the file manager v3 happen to change the first character of the name of ".mp4" to a capital letter, so i get back and change my html and it works.