Search code examples
iisiis-7iis-7.5

Permanently adding a mime type to IIS


Currently if you add a MIME type through iis as follows:

Open Internet Information Services (IIS) Manager

In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types.

In the MIME Types pane, click Add... in the Actions pane.

In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.

IIS will delete the entry when you do an IISRESET. There are some developers doing IISRESET and wiping out the user created mime types. My question is, how can I permanently add a MIME type so that even when a developer does an IISRESET, it will not be wiped out and will remain with the other default mime types. Thanks.


Solution

  • Doing an IIS reset should not reset values. I'd check to see if you have an application startup that does something like that. With that said, you could add the values to the server configuration file in:

    C:\Windows\System32\inetsrv\config\applicationHost.config

    You'd add your standard mapping as such:

    <staticContent>
         <mimeMap fileExtension=".ext" mimeType="text/plain" />
    </staticContent>
    

    Those values will not get reset during a service restart.