find a location for property in a new city

Wednesday 7 April 2010

Could not load file or assembly 'MyHttpModules' or one of its dependencies. The system cannot find the file specified. Web.config inheritance

I made a new Virtual Application in my current IIS site to my brand new web application and I get this filthy error. So I'm thinking, "Of course you cannot load the file or assembly because it isn't in this web application but then I didn't ask you to." So where is it coming from? This is what is happening and how to solve it.

The "problem" is to do with web.config inheritance. Your new virtual application is still inheriting from the site's root web.config despite being physically separated and so it is finding this reference to a resource that doesn't exist in the new application.

Solution

Let me introduce a little known attribute of the location element in configuration files. It is called inheritInChildApplications, which can be set to false and will do what is says on the tin. Simply place them around the settings you do not want inherited by your child app. Unfortunately you can only use it in quite a blanket fashion, i.e. you can put it around <system.web> but if you think you're putting it around individual settings then you must be crazy!

So for my problem with a nonexistent HttpModule I will need to stop the system.web and system.webServer inheriting in my child app:
<location inheritInChildApplications="false">
  <system.web>
    <!-- various web things -->
  </system.web>
  <system.webServer>
    <!-- various web server things -->
  </system.webServer>
</location>

Unfortunately, this is so unknown that apparently not even Visual Studio knows about it so you can bask in the glory of your handy work with a squiggly blue line! (I think a squiggly blue line must indicate good code!)

Follow britishdev on Twitter

11 comments:

  1. Thanks, this has helped me out.

    ReplyDelete
  2. I killed my Sharepoint environment, but got it back. You pointed me in the right direction. I needed to set the Web application pools that where in use by SharePoint. To .NET 2.0 instead of 4.0.
    Thanks a lot!

    ReplyDelete
  3. I am facing this problem since few days and finally yet found the solution. Didn't thought that this can be a solution, quite a simple solution but still not known to many of us.

    ReplyDelete
  4. your post was good.https://edutik.lilacinfotech.com/

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hello! The presence of plagiarism in an essay has always been considered a mistake, and your teacher may lower your grade if they find plagiarism in your text. You can eliminate plagiarism yourself by simply using our excellent online tool. It is multifunctional and absolutely free. It will help you improve your essays! >> https://www.copychecker.net/copy-and-paste-essay-checker/

    ReplyDelete
  7. Not so long ago I started to use in practice a specialized tool that helps to find errors related to active voice and passive voice. This is very convenient because I no longer have to spend a lot of time and effort on it myself. I add my text to it, and after a few minutes I already see what I need to fix and where I made mistakes.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Services such as sentence fragment checker https://www.sentencecorrector.info/online are a must-have in the online applications market that help thousands of users absolutely free of charge to create and correct texts of absolutely different directions and volumes on a daily basis. You can use it yourself by clicking on the link to the official website of the service.

    ReplyDelete
  10. To date, there are a huge number of different auxiliary tools that help to find various errors in text works. I also use one of these tools. fixing passive voice tool will check the correct use of the passive voice. All you have to do is add text to the tool and wait for the verification to be completed! Good luck friends!

    ReplyDelete