Lucas Buetto
Lucas Buetto

Reputation: 436

How to remove an extension from iis using web.config

This is my web.config and i want to change iis with it, but in localhost it breaks my site with error 500.

<staticContent>
  <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

Upvotes: 12

Views: 10006

Answers (2)

jpgrassi
jpgrassi

Reputation: 5742

Without the description of the error you are getting I can only presume you are adding a mimetype that already exists in the IIS server.

In these cases or where you are not sure, you can remove the extension prior to adding it, in your configuration file.

<staticContent>
  <remove fileExtension=".json" />
  <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

Upvotes: 8

Renan Barreiro
Renan Barreiro

Reputation: 745

Buetto, just add this line to your web.config:

<staticContent>
  **<remove fileExtension=".json" />**
  <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

It will change the iis configuration of your server (localhost).

Upvotes: 20

Related Questions