The Usual Tech Ramblings

IIS and unknown file types

Since IIS6, or there abouts, IIS will not host a file that it does not understand, or doesn’t have a MIME handler for. This is a security feature, but can cause some unknown issues…

We use some customer facing training software by Skillsoft. They produce a Java application which allows you to record voice, and screen shows for training, and follow up with a questionnaire after. Unfortunately because it’s Java, when something goes wrong, it’s very blackbox1 like, making it hard to diagnose any issues. In this case, the splash screen would load, and that’s where it’d stop.

Fortunately, the Java console does provide enough information to give us a hint as to what might be wrong. When opening a Java application, the little console app appears in the notification area next to the clock. This allows you to see if the app throws any errors. In our case, it was complaining that a file with the extension .properties was missing from the server (IIS was throwing a 404 message). A quick showed it existed in the directory structure.

This is because IIS doesn’t know what a .properties file is, or how it should be treated. This is easily remedied. In IIS manager, either under the site, or at the root level, go to the MIME option, and add it. In this case, the file extension was .properties, and the MIME Type was specified as application/octet-stream. If it’s done at the root server level, it applies to all sites. If you do it on a site, it only applies to the site you changed it on. No resets, or such, required. Now the file is served properly.

Microsoft has this documented on KB326965. Whilst this applies to IIS6, the same applies to IIS7 as well. To save some waiting in IIS7, you can use the appcmd to add the type for you…

appcmd set config /section:staticContent /+"[fileExtension='.properties',mimeType='application/octet-stream']"

This applies the setting at the root server level, and is usually inherited down to all sites.

  1. A term coined to explain that you can see the outsides, but have no idea what’s going on inside