views:

35

answers:

1

I am following the steps listed here: http://msdn.microsoft.com/en-us/library/dd483478.aspx at the bottom of that page are steps to manually migrate a web.config from .net 3.5 to 4.0

Currently, the site loads and routes fine, except for static data - images, css..

everything in the migration guide works fine, except : "7.Delete everything between the system.webserver section start and end tags, but leave the tags themselves."

when i do that, I get an error :

"HTTP 500.22 Module ConfigurationValidationModule   
Notification BeginRequest   
Handler Not yet determined   
Error Code 0x80070032 "

my system.webserver looks like this ( i changed 3.5.0.0 references to 4.0.0.0 manually):

 <system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <modules runAllManagedModulesForAllRequests="true">
   <remove name="UrlRoutingModule"/>
   <remove name="ScriptModule"/>
   <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add name="UrlRoutingModule" preCondition="" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  </modules>
  <handlers>
   <remove name="WebServiceHandlerFactory-Integrated"/>
   <remove name="ScriptHandlerFactory"/>
   <remove name="ScriptHandlerFactoryAppServices"/>
   <remove name="ScriptResource"/>
   <remove name="BlockViewHandler"/>
   <remove name="MvcHttpHandler"/>
   <remove name="UrlRoutingHandler"/>
   <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
   <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add name="UrlRoutingHandler" verb="*" path="UrlRouting.axd" preCondition="integratedMode" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></handlers>
 </system.webServer>

Does anyone know why I can't remove the section, as the guide says to? and why static files won't load? i imagine it's a related issue. thanks in advance!

EDIT: if i remove the BlockViewHandler line, everything loads fine. I still am not sure why I can't remove this entire section like the migration guide says, though.

A: 

There's more on this error here: AppCmd Migrate Config and HTTP Error 500.22.

You've shown us your <system.webServer> - but do you have anything under <system.web>/<httpModules> or <system.web>/<httpHandlers>? That could be the cause. In IIS7 integrated mode, these sub-sections need to be under <system.webServer> rather than <system.web>.


When you delete everything inside the <system.webServer>, you're deleting this line:

<validation validateIntegratedModeConfiguration="false"/>

which tells IIS not to validate that the configuration works in integrated mode. (This skipping of validation is OK if your app pool is actually running in classic mode.)

When this element telling it to skip validation is deleted, IIS tries to verify that the configuration is valid for integrated pipeline mode. This will fail if you have HTTP modules or HTTP handlers under the old <system.web> element. They need to be moved to <system.webServer>. You can either do this by hand, or you can use the "appcmd migrate config" command, which will update your web.config for you.

To migrate the web.config at the root of an IIS site, run appcmd migrate config like this (note the trailing slash):

appcmd migrate config "Your Site Name/"

To migrate the web.config for an application below the site root, do this:

appcmd migrate config "Your Site Name/Your App Name"

Once it's changed your web.config, you should commit the changes it made to your source-controlled copy of the web.config. Otherwise the changes will be blown away if you redeploy your web.config file from source control.

Richard Beier