Search code examples
windowsazuremime-typesogg

Serve .ogg in Windows Azure Web Role using Hosted Web Core


I have an Azure Web Role that is using the Hosted Web Core (i.e. is commented out in ServiceDefinition.cdef) and I can't seem to register the mimeType for .ogg to be served. I've done quite a bit of searching and found some suggested solutions but nothing seems to work.

One solution suggested adding the custom mime type in the web.config. This worked when running the web role as a web application on my local IIS (i.e. not in Azure), but when I run it in Azure, it does not work. The .ogg returns a 404.0 error (in fiddler, it has a Content-Type of text/html; charset=utf-8).

Another suggestion was to register a Start task in the ServiceDefinition.cdef which would run a cmd file which would call appcmd.exe to set the mimeType (e.g. %windir%\system32\inetsrv\appcmd.exe set config /section:staticContent /+"[fileExtension='ogg',mimeType='audio/ogg']"). Again, this did not work.

It seems that others have been having success with these methods when trying to serve other static content types. My only guess as to why it worked for them and not for me is that they were running Azure in full IIS mode while I am running in the Hosted Web Core.

Any help would be greatly appreciated.


Solution

  • My guess is that the .ogg file isn't actually there. Make sure the .ogg is part of your Visual Studio project and marked as "Build Action = Content." (Locally, this might just work because the .ogg file is in the same directory as the rest of your code, but in the cloud, it may not get published.)

    (This should be pretty easy to test if you have Remote Desktop enabled for your app. Just remote into one of the instances and look around for the site on the E:\ drive. Then look to see if the .ogg file is actually there where you expect it to be.)