Could not load file or assembly 'App_Web...'

by joey.westcott 10. August 2008 16:37

Could not load file or assembly 'App_Web_9olwzuwu, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
 

Error:
Every now and then an ASP.Net 2.0 production app is coming up with the error “Could not load file or assembly 'App_Web...".   The app works fine up until that point and then it breaks and the only solution seems to be a full recompile.   It somehow seems like it is occurring when the application has recycled and .Net Framework recompiles the site to its temp files. 

Problem:
The website is throwing an error trying to load a custom web control.  You see in the last release, we added a new custom control to another custom web control that is displayed as needed.  Because the outer most/parent control and the new child control are separate controls in source, when the .Net Framework goes to compile one of these two controls and does not recompile the other one at the same time you will have a an out of date file trying to reference the old version of the assembly.  The fact that the .Net framework appends a random string to the name of the assembly at compile time the name of the newly compiled file and the previous version of the file cause a file name mismatch and therefore the outer/parent control is looking for a file that no longer exists. 

Possible Permanent Fix:
WARNING:
The Hotfixes available through this program have not gone through full Microsoft product regression testing. Specifically, these Hotfixes have had targeted testing which does not include testing in combination with other Hotfixes. You are encouraged to install only the Hotfixes needed to address the particular product problem you may have.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;934839

Possible Work Around(s) or Temporary Fixes:
1) By setting the batch property of the compilation tag to false in the web.config file
2) You can also decrease how often it happens by setting:
    <compilation debug="false" numRecompilesBeforeAppRestart="50" />

See the KB Article 934839 for more details

Fixes for the Issue after it has already taken place:
1) Delete temp ASP.Net files (this takes down the site)
2) Force the parent/outter control to recompile, edit and save the code file.  This is a better option for a fix than #1 because this does not bring down the website.

My Suggestion:
1) First I think that we should put in place the temporary fix #1 from above, this might prevent all issues in the future and could be the only answer we need.
2) Second I would download and install the 934839 hotfix from Microsoft in the QA environment to verify that it does not cause any problems. After some time of testing the hotfix in QA I would install the hotfix to have a permanent fix for this issue. At this time we could remove the temporary work around #1.

Links:

Other Helpful Links on the subject:

 
 
 
EDIT: After putting Temp fix #1 I have not had the problem again.  I have had this fix in place for over 6 months and all is good! 
 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Development | .Net | Work

Comments

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen