Saturday, 17 October 2009

Web.Config Inheritence to Virtual Directory Application - 'inheritInChildApplications' Attribute...

Had a problem recently where an ASP.NET MVC 1.0 site was not reading the web.config in the virtual directory that we has created for it (using Helm). It was defaulting back to the main site's web.config file (in the wwwroot directorty). The error message we got was like this:

============================================================

Server Error in '/blah' Application.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'MagicAjax' or one of its dependencies. The system cannot find the file specified. (<path_to_folder>\wwwroot\web.config line 133)

============================================================

...so, (FYI, this has nothing to do with MagicAjax, just using this error as an example of the type of problem that can crop up) the site is trying to read '<path_to_folder>\wwwroot\web.config', instead of the web.config file in the virtual directory we had setup, which was  '<path_to_folder>\wwwroot\blah\web.config'. 

This problem is something that can be handled in the top level (wwwroot) config file by using the 'inheritInChildApplications' attribute – the following article provides further detail:


I encountered this error on the evening of deployment – a couple of long hours of tense Googling yielded this result, which worked...

No comments:

Post a Comment