14

我已经阅读了关于同一问题的许多其他问题,但我仍然不明白原因以及如何防止它发生。

就我而言,这发生在生产服务器上。我得到了与其他问题中描述的相同的错误,我通过将程序集重新复制到 bin 目录来解决它。它们甚至不是重新编译的文件,它们与之前存在的文件相同 - 再次复制,然后它开始毫无问题地工作。

奇怪的是,我正在使用 Web 部署项目将所有程序集文件重命名为基于文件夹的 dll。所以 folder.dll 和 folder.subfolder.dll 而不是 App_Web_jt8nxllz.dll。然而,错误仍然命名原始 App_Web_jt8nxllz.dll 文件。

删除C:\WINDOWS\Microsoft.NET\Framework[64]\v...\Temporary ASP.NET Files文件夹的内容可以正常工作,但有谁知道如何防止此错误发生?此外,当它发生在生产服务器上时,关闭 IIS 或重新启动它确实不太可行。也许会自动清除调度程序上的 Temp 文件夹?

这里真正的问题是什么?有什么特别的原因导致这种情况发生吗?该站点将毫无问题地嗡嗡作响,然后突然之间,整个文件夹停止工作并产生此错误。

Could not load file or assembly 'App_Web_jt8nxllz, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Exception type 'System.IO.FileNotFoundException' was caught.
Source: App_Web_whv5zsvd
Target Site: Void __BuildControlTree(ASP.artists_controls_artistheader_ascx)
Stack Trace:
   at ASP.artists_controls_artistheader_ascx.__BuildControlTree(artists_controls_artistheader_ascx __ctrl)
   at ASP.artists_controls_artistheader_ascx.FrameworkInitialize()
   at System.Web.UI.UserControl.InitializeAsUserControlInternal()
   at System.Web.UI.UserControl.InitializeAsUserControl(Page page)
   at ASP._artists_artist_master.__BuildControlctlArtistHeader()
   at ASP._artists_artist_master.__BuildControlctlContent(Control __ctrl)
   at System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container)
   at ASP.master_mysite_master.__BuildControlMainContent()
   at ASP.master_mysite_master.__BuildControlform1()
   at ASP.master_mysite_master.__BuildControlBody()
   at ASP.master_mysite_master.__BuildControlTree(master_mysite_master __ctrl)
   at ASP.master_mysite_master.FrameworkInitialize()
   at System.Web.UI.UserControl.InitializeAsUserControlInternal()
   at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
   at System.Web.UI.MasterPage.get_Master()
   at System.Web.UI.MasterPage.ApplyMasterRecursive(MasterPage master, IList appliedMasterFilePaths)
   at System.Web.UI.Page.ApplyMasterPage()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
4

3 回答 3

8

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!

于 2009-08-09T06:19:19.217 回答
3

我遇到了这个问题,有一个修复程序。

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

尽管它不再发生在较新的机器/设置上。

于 2009-04-24T04:35:46.407 回答
0

清除临时文件或更改 web.config 对我不起作用。对我来说,修复它的是重新启动我的计算机。

于 2016-08-17T13:26:08.817 回答