ASP.NET corrupt assembly “Could not load file or assembly App_Web_*”

徘徊边缘 提交于 2019-11-30 08:46:59
YetAnotherDeveloper

Not to just link up my site but i have run into this issue and i wrote a blog post on the topic. Check it out, it has links to more info on this topic. But to sum it up here are the details:

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 Work Around(s) or Temporary Fixes:

1) By setting the batch property of the compilation tag to false in the web.config file

<compilation debug="false" batch="false" />

2) You can also decrease how often it happens by setting by the numRecompileBeforeAppRestart property:

<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.

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

I've been hit with this, there is a hotfix for it.

http://weblogs.asp.net/scottgu/archive/2007/04/11/public-hotfix-patch-available-for-asp-net-compilation-issues.aspx

Although it doesn't happen with newer machines/setups anymore.

Clearing out the temp files or changing web.config didn't work for me. For me, what fixed it was restarting my computer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!