问题
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.
回答1:
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
回答2:
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
来源:https://stackoverflow.com/questions/28274486/iis-returns-404-not-found-for-mp4-files