如何使用web.config从iis中删除扩展

时间:2022-06-01 22:19:23

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

这是我的web.config,我想用它来更改iis,但是在localhost中它会错误我的网站错误500。

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

2 个解决方案

#1


10  

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

Buetto,只需将此行添加到您的web.config:

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

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

它将更改服务器的iis配置(localhost)。

#2


1  

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.

如果没有您所获得的错误的描述,我只能假设您正在添加IIS服务器中已存在的mimetype。

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>

#1


10  

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

Buetto,只需将此行添加到您的web.config:

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

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

它将更改服务器的iis配置(localhost)。

#2


1  

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.

如果没有您所获得的错误的描述,我只能假设您正在添加IIS服务器中已存在的mimetype。

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>