<< Back To All Blogs
Resolving ASP.NET Web.Config Inheritance
Thursday, December 3rd, 2009
I recently came across an issue with the following error:
"Could not load file or assembly 'Microsoft.BusinessFramework' or one of its dependencies. The system cannot find the file specified."
I received this error while deploying a custom ASP.NET application on top of our existing SharePoint installation, in the root of our SharePoint site.
After doing some digging, even though my ASP.NET application was a separate ASP.NET application, it still inherits from the root application, which is SharePoint, and in this case, we had Business Portal installed on SharePoint as well (which added Business Portal assemblies to the root SharePoint web.config). When my new application was created, the bin folder obviously did not have the BusinessFramework assemblies included, but was still inheriting the requirement from the parent web.config.
One obvious resolution was to copy Microsoft.BusinessFramework.dll and BusinessFramework.config to the bin folder of my new application, but this is both bad practice and is not the true resolution for our issue at hand.
You can, however, clear previous inherited HTTP modules in the application Web.config. So, in our custom ASP.NET application, I added the clear element at the top of the httpModules element such as follows:
This will clear any previous inheritted ASP.NET HTTP Modules and eliminate the issue that we were running into.
As a side note, you can also add inheritInChildApplications="false" in the root web.config's location element which will also fix inheritance issues, but the problem with this is we have other applications which do require that SharePoint's web.config properly inherit. Hopefully in the next .NET edition Microsoft will add the ability for something like inheritFromParentApplication so that you can not inherit per child application, instead of making the parent not pass to all children.
Configin' Tom Out.
Resolving Odd 5 Minute Timeout in HttpWebRequest.
Impersonating a user in ASP.NET
Configuring ASP.NET (And SharePoint) to use SQL-based Sessions
Validate a Windows Username and Password against Active Directory
Writing console output from a Windows form in C#
Currently no comments.
Add A Comment
Email Address: (not public, used to send notifications on further comments)
Enter the text above, except for the 1st and last character: