Thursday, 22 November 2012

Adding MIME Types

1. Adding MIME types in IIS EXPRESS


Please follow steps below to add a mime type such as SVG to IIS EXPRESS.
  • Open a console application with administrator privilages.
  • Navigation to the IIS Express directory. This lives under Program Files or Program Files (x86)
  • Run the command appcmd set config /section:staticContent /+[fileExtension='svg',mimeType='image/svg+xml']
This will add the necessary MIME extension to IIS so it will serve SVG files without issue.
2. Adding MIME types in web.config
Edit web.config to add following.
Below is an example where i am adding mp4 and m4v mimetypes to web config. 
<configuration>    
<system.webServer>
        <staticContent>
            <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
            <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
     </staticContent>
    </system.webServer>
</configuration> 
3. Adding MIME types in IIS
Open IIS, Go to your site and then under IIS --> SELECT MIME TYPES AS SHOWN IMAGE BELOW AND SELECT OPEN FEATURE FROM ACTIONS ON THE RIGHT SIDE. 

On the next screen click Add udner actions to add a new MIME TYPE 

No comments:

Post a Comment