iismime-typesgoogle-earthkmz

Google Earth (.kmz) mime type IIS issue


I am experiencing a peculiar issue with IIS and KMZ files. I have added the MIME type to IIS and it works just fine -- however, seemingly randomly the MIME type is removed. This has happened a few times now, and each time all I have to do to fix the issue is just add the MIME type again.

The issue is identified when broken links are reported, and as soon as I add the MIME type back in all is well.

Any thoughts on what is causing it, or methods for finding out what's causing it?

Thanks!


Solution

  • My guess is that someone is overwriting or modifying your web.config file. You can modify the web.config using either the IIS server tools or by publishing the project containing the web.config file. If you are modifying your IIS settings using IIS Manager, then every time someone re-publishes the web application it changes those settings. Make sure the correct settings are saved in your web.config in your root VisualStudio project. So that whenever that project is published it's setting the correct IIS settings.

    <configuration>
    
      <system.webServer>
        <staticContent>
          <remove fileExtension=".kml" />
          <mimeMap fileExtension=".kml" mimeType="application/vnd.google-earth.kml+xml" />
          <remove fileExtension=".kmz" />
          <mimeMap fileExtension=".kmz" mimeType="application/vnd.google-earth.kmz" />
        </staticContent>
      </system.webServer>
    
    </configuration>