HTTP Error 500.22 - Internal Server Error
检测到在集成的托管管道模式下不适用的 ASP.NET 设置。
最可能的原因:
- 此应用程序在 system.web/httpModules 节中定义配置。
可尝试的操作:
- 将配置迁移到 system.webServer/modules 节。也可以手动这样做,或通过在命令行中使用 AppCmd 来这样做。例如,从 IIS Express 安装目录运行 appcmd migrate config "Default Web Site/"。使用 AppCmd 迁移应用程序将使它能够在集成模式下工作,并能继续在经典模式下和以前版本的 IIS 上工作。
- 如果您确信可以忽略此错误,则可以通过将 system.webServer/validation@validateIntegratedModeConfiguration 设置为 false 来禁用它。
- 也可以将应用程序切换到经典模式应用程序池。例如,从 IIS Express 安装目录运行 appcmd set app "Default Web Site/" /applicationPool:"Clr4ClassicAppPool"。只有在无法迁移应用程序时才这样做。
Detailed Error Information:
Module | ConfigurationValidationModule |
---|---|
Notification | BeginRequest |
Handler | PageHandlerFactory-Integrated-4.0 |
Error Code | 0x80070032 |
Requested URL | http://localhost:58327/index.aspx |
---|---|
Physical Path | F:\C#\HttpTestApplication\HttpTestApplication\index.aspx |
Logon Method | 尚未确定 |
Logon User | 尚未确定 |
请求跟踪目录 | C:\Users\Administrator\Documents\IISExpress\TraceLogFiles\HTTPTESTAPPLICATION |
More Information:
集成模式是在 IIS 7.0 及更高版本上运行 ASP.NET 应用程序的首选模式。
解决:
打开Web.config
增加下面代码
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="TestModule" type="ClassLibrary831.TestModule,ClassLibrary831"/>
</modules>
</system.webServer>
大概意思是:
禁止验证集成模式,来避免错误。
完整代码如下
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
<httpModules>
<add name="TestModule" type="ClassLibrary831.TestModule,ClassLibrary831"></add>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="TestModule" type="ClassLibrary831.TestModule,ClassLibrary831"/>
</modules>
</system.webServer>
问题参考一
https://blog.youkuaiyun.com/a351945755/article/details/21000453
实例参考
httpModules 与 httpHandlers
https://www.cnblogs.com/chenlulouis/archive/2009/12/18/1626918.html