Video file is not playing through IIS server - asp.net

I have added the html 5 video tag in my web page. The video is running (locally) on an IIS server which is the hosting machine. But when I run through the domain name it's not running (outside of IIS).
Folder permission is also given, but it runs from IIS Local.
I added the mime type on the IIS server.
var video = document.getElementById('videotag');
video.src = '../Images/Videos/example.webm';
video.play();

There is only a single way to do this currently. If your type of video is MP4 running on IIS/.NET
Add a web.config file to the root of the application wwwroot\web.config with the following contents
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="application/mp4" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
</configuration>

Related

Extention .msg in iis server

I'm trying to open .msg file but it won't even if i add this
<staticContent>
<remove fileExtension=".msg" />
<mimeMap fileExtension=".msg" mimeType="application/vnd.ms-outlook" />
</staticContent>
i also tryed to add it manually in IIS Server b-t it doesn't work

Why IIS8.5 try use dynamic compression for static JSON and SVG files?

I have one more question about IIS compression
I have static file ../wwwroot/src/locale/en-us.json and sgv
But IIS8.5 recognizes it as a dynamic content and try to use dynamic compression
What I must do to force IIS works with .json and .svg in the same way like .js and .css
The issue was in mime types, by default IIS doesn't apply dynamic compression for application/json and xml/svg+xml
I don't have access to web server configuration and I made a workaround in local web.config
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="text/json" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="text/svg+xml" />
</staticContent>

IIS registered mime types

I have and web application that need some mime types registered on web.config:
Like theses:
<staticContent>
<mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
<mimeMap fileExtension=".json" mimeType="application/json"/>
<mimeMap fileExtension=".pkg" mimeType="application/x-newton-compatible-pkg" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
</staticContent>
When a run the app on IIS 7, all work correctly. but under IIS 8 (windows 10 pc), I should have to modify the web.config like this:
<staticContent>
<!--mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" /-->
<!--mimeMap fileExtension=".json" mimeType="application/json" /-->
<mimeMap fileExtension=".pkg" mimeType="application/x-newton-compatible-pkg" />
<!--mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/-->
<!-- This must be enabled in some environments -->
</staticContent>
I know that on new IIS versions some mime types are registered as default, when I try to register its on my web.config some conflicts are generated with that mime types.
How I can, Automatically, detect if IIS have theses mime types or not, and modify my web.config automatically?
In your web.config, always remove those MIME types first and then add them. Then your file works in all cases.

Why does adding woff2 mimetype on web.config is not working on IIS?

After some research i've noticed that in order to use woff2 font types with IIS you need to set the following on the web project's web.config in order to avoid getting 404s from the server:
<staticContent>
<remove fileExtension=".woff"/>
<remove fileExtension=".woff2"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
Locally, this seem to work, but when the project is deployed on IIS, I keep getting 404s, what could be the cause of the issue? Thanks
I had the same the problem today; I discovered the fonts were not included/added in my project.

How to allow .config, .map, .browser files to be downloaded IIS

ITo download updates for a game, I've configured IIS 7.5 to download any type of file such as .html, .xml, .aspx etc. But there is one problem.
I am not able to download the files of type .map, .browser, .config. Actually these are files related to game. Without these files the update doesn't complete.
Can you please help me in solving these issues.
You need to add MIME types for these extensions.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".config" mimeType="text/xml" />
<mimeMap fileExtension=".map" mimeType="text/plain" />
<mimeMap fileExtension=".browser" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
On side note making these file available to client may cause serious security threat.

Resources