Pubblicando un sito
ASP.NET 4 su
IIS 7 può capitare di incorrere in questo
errore:
HTTP Error 500.23 - Internal Server Error
An
ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
In pratica alcune sezioni del
web.config non risultano più valide con
IIS 7 quando è impostato in
integrate mode. Queste sezioni sono
httpHandlers e
httpModules.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.file" type="Sgart.GetFile, Sgart" />
</httpHandlers>
</system.web>
</configuration>
Tramite la seguente direttiva del web.config è possibile fare in modo che
IIS 7 ignori il controllo di queste sezioni
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
o meglio ancora si possono spostare le direttive presenti in
configuration / system.web / httpHandlers / add nella nuova sezione, compatibile con
IIS 7, ovvero
system.webServer / handlers. In questo caso va aggiunto anche l'attributo
name<configuration>
<system.webServer>
<handlers>
<add name="FileStoredOnSQL" verb="*" path="*.file" type="Sgart.GetFile, Sgart" />
</handlers>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>