如何修复 HTTP 错误 500.22 - 内部服务器错误检测到 ASP.NET 设置不适用于集成托管管道模式

How to fix HTTP Error 500.22 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode

我正在学习 Http modules,在上次尝试中我收到了:

HTTP Error 500.22 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

建议的解决方案之一是:

from the IIS Express install directory, run appcmd migrate config "Default Web Site/".

所以在命令提示符下我转到 C\Program Files\IIS Express 然后我执行了:appcmd migrate config "Default Web Site/"

我收到的命令 "Migrate" 在对象配置上不受支持。

如何正确操作?

Chk my SO Post

终于可以破解VS.Net 2015及其IISExpress配置了。无法对其进行配置 'externally',如果您在 VS.Net.

之外继续修改 IIS 或 IISExpress 设置,则任何操作都将无效

我花了一段时间才将注意力集中在 VS.Net 项目属性和配置上。我发现 VS.Net 创建了自己的 "applicationhost.config" 版本,可以在 -

找到

<myProject.sln path> \.vs\config\applicationhost.config

这是我必须更改应用程序池的文件 (applicationPool="Clr4ClassicAppPool) -

    <sites>
        <site name="WebSite1" ... ignore this sction if present
        </site>
        <site name="myProject" id="2">
            <application path="/" applicationPool="Clr4ClassicAppPool">
                <virtualDirectory path="/" physicalPath="D:\Source\myProject" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:1960:localhost" />
            </bindings>
        </site>

您只需要更改 applicationPool(您的经典应用程序池名称可能不同,在这种情况下,请从同一文件中获取正确的名称)。还要确保您'重新更新正确的 "site" 节点(从 VS.Net 调试时网络应用程序的正确本地主机 url)

如果仍然存在问题,请设置以下 -

<applicationDefaults applicationPool="Clr4IntegratedAppPool" />

希望这对您有所帮助。

您应该将 web.config 更改为以下内容:

<system.webServer>
<validation validateIntegratedModeConfiguration="false" /> 
</system.webServer>