Yesterday I tried to migrate an Web Application from IIS 6 to IIS 7 integrated managed pipeline mode. After copying the files to the new folder I opened a Web browser and got following error message:
HTTP Error 500.22 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
- This application defines configuration in the system.web/httpModules section.
Things you can try:
(Set "Default Web Site" and "Classic .NET AppPool" to your application path and application pool name)
- Migrate the configuration to the system.webServer/modules section. You can do so manually or by using AppCmd from the command line - for example, %SystemRoot%\system32\inetsrv\appcmd migrate config "Default Web Site/". Using AppCmd to migrate your application will enable it to work in Integrated mode, and continue to work in Classic mode and on previous versions of IIS.
- If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation@validateIntegratedModeConfiguration to false.
- Alternatively, switch the application to a Classic mode application pool - for example, %SystemRoot%\system32\inetsrv\appcmd set app "Default Web Site/" /applicationPool:"Classic .NET AppPool". Only do this if you are unable to migrate your application.
Since IIS 7 you’ll get more richer error messages and things you can try. In the lower section you’ll find as first step you can try to run AppCmd with the migrate option. I simply copied the command in a command box, hit enter and got an error message that there is no Default Web Site. Ah, I can remember, I changed the name of the Web site some weeks before so I have to check for the real name of the Web site. As the IIS knows the real name the error message could contain the name already. Running AppCmd again with the correct name was working, now.
migrated changed web.config I noticed that AppCmd didn’t migrate my HTTP handlers.
My old HTTP handler configuration looks like this:
<httpHandlers> <add verb="GET" path="ScriptEngine.ashx" type="AjaxPro.Web.ScriptEngineHandler,AjaxPro" /> <add verb="*" path="*.ashx" type="MS.Web.PageHandlerFactory,PcTopp.Library" /> </httpHandlers>
AppCmd creates the new system.webServer section at the end of the web.config file with following configuration:
<handlers> <add name="*.ashx_*" path="*.ashx" verb="*" type="MS.Web.PageHandlerFactory,PcTopp.Library" preCondition="..." /> <add name="ScriptEngine.ashx_GET" path="ScriptEngine.ashx" verb="GET" type="..." preCondition="..." /> </handlers>
Another problem I had to fix manually are all of my location tags. The AppCmd migrate process didn’t change any of them:
<location path="ajaxpro"> <system.webServer> <handlers> <add name="AjaxPro" verb="GET,POST" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro" /> </handlers> </system.webServer> <system.web> <httpHandlers> <add verb="GET,POST" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro" /> </httpHandlers> <authorization> <allow users="?" /> </authorization> </system.web> </location>
I have left the old httpHandlers tags that the same web.config is still working on IIS 6.