4

我在 IIS 中安装了一个 .NET 3.5 Web 应用程序,它提供了多个 WCF 服务。这已经在数十家公司部署了一年多,但是最近他们在一台服务器上调用服务或导航到 IE 中的 .svc 文件时遇到了这个错误:

System.ServiceModel.ServiceActivationException: The service '/MyService/MySyncService.svc' cannot be activated due to an exception during compilation. The exception message is: Could not load file or assembly 'App_global.asax.vtxl8efb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.. ---> System.IO.FileNotFoundException: Could not load file or assembly 'App_global.asax.vtxl8efb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'App_global.asax.vtxl8efb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

服务器在周末应用了 Windows 更新,之后发生此错误并且服务无法正常工作。同一台服务器上的另一个 .NET 3.5 Web 应用程序(不是 WCF)运行良好。

我能够通过停止应用程序池、删除 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\myservice 中的文件并再次启动应用程序池来解决问题。

但我真的很想知道为什么会发生这种情况以及我能做些什么来防止它发生。在我的所有客户应用 Windows 更新后,要求他们完成这些步骤对我来说似乎是不合理的。

我没有将 Web 部署项目与这些应用程序中的任何一个一起使用(我能找到的唯一对此类错误的引用都指 Web 部署项目,例如this)。我的 Web 应用程序项目已构建,然后进行复制部署。

它看起来有点像来自 MS 的这个问题,他们已经发布了一个补丁,但实际上并不相同。

交叉张贴在MSDN 论坛中。

4

1 回答 1

1

这更像是一个历史猜测,我认为您正在看到我在上一份工作中看到的内容。

当您安装安全更新或 .net 框架更新并且在安装更新时应用程序 [站点] 仍在使用中时,会出现此问题。它不能清除所需的文件,也不能算作将影子复制缓存标记为脏的事件,因此它不会重新编译。问题是现在无法访问 dll,因为 [这是我不能 100% 确定的地方] 我认为 dll 上的入口点发生了变化,因此 dll 在系统看来不是正确的. 因为它找不到它认为正确的东西,所以它抛出了上面的异常。如果您让系统通过触摸文件 [dll 或配置] 将您的应用程序标记为已更改,则足以使其重新编译卷影副本。

于 2014-12-02T05:40:48.407 回答