AppCmd Migrate and HTTP Error 500.22

Posted by: Ajax.NET Professional, on 07 Nov 2008 | View original | Bookmarked: 0 time(s)

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:

IIS 7.0 - Detaillierter Fehler - 500.22 - Internal Server Error - Internet Explorer bereitgestellt von DellHTTP 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:

  • 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.
(Set "Default Web Site" and "Classic .NET AppPool" to your application path and application pool name)

Since IIS 7 youll get more richer error messages and things you can try. In the lower section youll 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.

When trying to start my Web Application I noticed that I got some JavaScript error messages and that some of my HTTP handlers are not working. A deeper look inside my migrated changed web.config I noticed that AppCmd didnt 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>

Notice that the lines are interchanged and the ScriptEngine.ashx will never be executed, now. The ScriptEngine in my project will offer JavaScript file packages that are compressed and optimized for each section of the application.

Another problem I had to fix manually are all of my location tags. The AppCmd migrate process didnt 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.

Category: C# | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 4178 | Hits: 3

Similar Posts

  • Generate stunning ASP.NET/AJAX applications with Web Site Factory more
  • WcfTestClient with Windows Azure more
  • Stumbling through: K2 blackpearl 090x (Part II) more
  • How to fix Sys.WebForms.PageRequestManagerParserErrorException in ASP.NET 2.0 AJAX 1.0 more
  • 12 ASP.NET MVC Best Practices more
  • TIP: How To Generate a Fully Qualified URL in ASP.NET (E.g., http://www.yourserver.com/folder/file.aspx) more
  • RELEASED ASP.NET MVC 2 Preview 2 more
  • Deleting All Records In a Table EXCEPT For the N Most Recently Added Records more
  • Stimulsoft Reports. New versions of reporting tools for .NET, Web, and WPF more
  • Quick Reference Guide for Telerik Support more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD