简体   繁体   中英

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>

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).

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM