web.config 在 IIS 7.5 下工作在 IIS 10 下不工作

web.config that worked under IIS 7.5 doesn't work under IIS 10

我在 IIS 7.5 下有一个 ASP.NET 网站 运行 效果很好。

现在我们正在试验运行 IIS 10 的新 Windows 10 服务器。将相同的网站复制到新服务器并尝试打开它:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.
...
Error Code     0x8007000d
...
Config Source:
  -1: 
   0: 

looked up错误代码:

Cause: This problem occurs because the ApplicationHost.config file or the Web.config file contains a malformed XML element.

Resolution: Delete the malformed XML element from the ApplicationHost.config file or from the Web.config file.

但是那个 web.config 文件已经工作多年了。什么也没有变。所以我认为“格式错误 xml”消息是一个转移注意力的信息,而且我一定还缺少其他一些设置。

有什么想法吗?

我 运行 遇到了完全相同的问题,对我来说,这是因为我忘记为 IIS 安装 Url Rewrite 2.0,所以我的重写规则导致了错误。不确定这对您来说是否相同。

我通过注释掉 web.config 的块来解决这个问题,直到我让它停止抛出该错误。

希望对您有所帮助!