Bizarre behavior for mp3 mimeMap in IIS 7 - iis

I have encountered a completely unexpected behavior when adding a mimeMap element for files with mp3 extensions. This works fine:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
<!-- <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> -->
</staticContent>
</system.webServer>
But as soon as I uncomment the element pertaining to MP3 files, everything goes to hell in a proverbial handbasket. Neither my js nor my css nor my aspx files will be served, and I get lots of these:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Anyone seen this behavior before, or have any pointers? I am (clearly) less than adept in IIS configuration.

this behavior might be because.. In IIS the mimetype for mp3 is already configured.
you adding in web.config mimemap for mp3 will cause duplicate entry.
just do
<remove fileExtension=".mp3"/>
<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
regards
Goutham Ganesh V

Related

Downloadable Font failed, IIS

The custom fonts I am using on my website aren't provided by IIS 8.5.
I have set the MIME-Types as followed:
<remove fileExtension=".ttf" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
.eot works fine (or at least doesn't give me errors in the web debugging windows).
The other formats (woff, woff2, tff) won't work and give me a 404 Not found error.
I think IIS has access to the fonts folder as the eot files work just fine.
Firefox throws this error:
GET
https://prefix.someurl.iis/Resources/Fonts/GlyphaLTStd.woff [HTTP/1.1 404 Not Found 53ms]
Any help appreciated.
Alright, I was able to fix it.
Turns out my lazyness got in the way again (why does this keep happening..?).
Lazy me copied the reference source paths in the font-face declarations so the CSS file didn't get the source-url properly somehow.
Hope this helps other people.

How to web serve a file without an extension on GoDaddy's web hosting service?

When setting up universal links for iOS apps, Apple states:
Create an apple-app-site-association file that contains JSON data about the URLs that your app can handle.
Upload the apple-app-site-association file to your HTTPS web server. You can place the file at the root of your server or in the
.well-known subdirectory.
We have created a file named "apple-app-site-association" without an extension, but if navigate to "http://ourdomain.com/apple-app-site-association" we get a 404 file not found error.
Apple specifies not to add a .json to the filename.
We see another SO overflow answer describing configuration changes to IIS to serve files without extensions. But what is the trick to getting this file to be served properly from GoDaddy's Linux or IIS servers?
I was able to get this to work by adding an .htaccess file at the root level that contains:
<Files "apple-app-site-association">
ForceType application/json
</Files>
Oddly, I could not get this to work if I tried to put the apple-app-site-association and the .htaccess files in the .well_known directory.
With this configuration, the validator here https://branch.io/resources/universal-links/ was all green and the links themselves worked.
This is what worked for us.
We put this text in a file named "web.config" in our main web directory along with the apple-app-site-association file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".xml"/>
<remove fileExtension=".svg" />
<remove fileExtension=".ttf" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<remove fileExtension=".json" />
<remove fileExtension=".otf" />
<remove fileExtension=".mp4" />
<remove fileExtension=".zip"/>
<remove fileExtension=".eps"/>
<remove fileExtension=".pdf"/>
<mimeMap fileExtension=".pdf" mimeType="application/pdf" />
<mimeMap fileExtension=".zip" mimeType="application/zip"/>
<mimeMap fileExtension=".eps" mimeType="application/octet-stream"/>
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".otf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".xml" mimeType="text/xml" />
<mimeMap fileExtension="." mimeType="application/pkcs7-mime"/>
</staticContent>
</system.webServer>
</configuration>
Of note, that properly serves the file without an extension - BUT - as we understand it - Apple still requires two other steps. (1) Your server must get an SSL certificate so it can serve that file by HTTPS (that is a ~$60/year purchase on GoDaddy); (2) Your server must also code-sign the apple-app-site-association file (that is a ~$150/year on GoDaddy for a downloadable certificate which can code sign files.)

Azure web app configuration for MP4

There seems to be a strange problem with my Azure webapp. I can't view MP4 files on my browser at all. After exploring few articles here, I did the following:
I use Github continuous deployment, so I created a new file called "Web.config". The content of it is the following:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
</system.webServer>
</configuration>
I made sure on the FTP that the file exists in the '/site/wwwroot' directory, and it does. I also made sure the MP4 file exists on the FTP in an accessible location.
The error I get on the website is the following:
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
Can anyone help me debug this problem?
Following our discussion, your web.config is right.
You have to make sure to locate it in the right location to make it works (the virtual application root in your case).
As Azure App Service is using IIS, you can find more details regarding IIS configuration files here: http://www.iis.net/learn/get-started/planning-your-iis-architecture/deep-dive-into-iis-configuration-with-iis-7-and-iis-8
I hope this helps,

SECURITY_DENIED_BY_MIMEMAP error when serving WOFF font from Azure

I've got a test Wordpress site running in Azure as an Azure Website using the Wordpress install from the Azure gallery.
The site is functional and appears to be working as expected. With one exception. I'm using a custom webfont - http://fortawesome.github.io/Font-Awesome/.
This font has an OTF, SVG, TTF, EOT and WOFF version. From what I understand different devices/browsers use different versions of the file to render to the font.
I'm having a problem serving the .woff version of the file.
I have turning on the logging within the Azure portal and I can see the following error
SECURITY_DENIED_BY_MIMEMAP
FileName
C:\DWASFILES\SITES\WWW-MYWPTESTSITE\VIRTUALDIRECTORY0\SITE\WWWROOT\WP-CONTENT\THEMES\AVADA\AVADA\FONTS\FONTAWESOME-WEBFONT.WOFF
I have confirmed that the .woff file exists on the server by logging into via SFTP and browsing to the folder.
I have seen other posts online about adding this information to the web.config file. Something like:
<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
</configuration>
However, I'm not sure how this can, or should, be added to the Azure hosted site.
UPDATE: Save the above code as web.config and upload to the wwwroot folder. Azure will now allow the .woff font to be downloaded when requested.
Save the following as web.config. Upload the web.config file to the wwwroot folder of the site hosted in Azure. The .woff files will now be served.
<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
</configuration>

Use SVG in Windows Azure Websites

Does anyone know if it is possible to add the SVG mime type to a Windows Azure Website?
I tried with a web.config file but that only broke my website.
Is this a limitation of the current preview or am I missing something?
thanks for your help!
What you can do in Windows Azure Websites (on web.config level) is pretty limited, but you should be allowed to add the mime type under staticContent:
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svg"/>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
</system.webServer>
</configuration>
Others like me may have reached here having the same problem not resolved because of other related file types, in my case I also needed .eot and .woff mime mappings.
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>

Resources