【问题标题】:Strange and random occuring Assembly not found error奇怪和随机发生的 Assembly not found 错误
【发布时间】:2011-10-13 00:31:30
【问题描述】:

我做了一个简单的 ajax 服务(基于 json)来从数据库中获取一些数据。 问题如下:

在本地主机上:在 Visual Studio 中编程/编辑 aspx 页面并在浏览器中查看结果时,它可以正常运行 5-6 次编辑 aspx 页面,然后开始失败。直到我去我的网络服务接口类做一些事情(比如在某处放一个换行符)并重新编译它。问题得到解决,循环继续......

当我在 fire bug 中跟踪失败的请求时,我发现 500 内部服务器错误: [FileNotFoundException:无法加载文件或程序集“App_Web_lbgnha4m,版本=0.0.0.0,文化=中性,PublicKeyToken=null”或其依赖项之一。该系统找不到指定的文件。] *下面的完整堆栈跟踪。

我不确定,但看起来这个文件“App_Web_lbgnha4m”是临时生成的,因为每次我通过重新编译代码来修复这个错误。一段时间后,它又以新名称“App_Web_blahblahblah”回来了

我最担心的是,当我将解决方案部署到临时服务器时。该服务运行良好(比如一天),然后出现同样的错误,非常惊讶在部署后不接触文件的情况下出了什么问题)。显然我不能每天都部署解决方案来解决这个问题......

任何建议请帮助......

全栈跟踪:

[FileNotFoundException]: Could not load file or assembly 'App_Web_lbgnha4m, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   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)
[ServiceActivationException]: The service '/Website/RESTfulService.svc' cannot be activated due to an exception during compilation.  The exception message is: Could not load file or assembly 'App_Web_lbgnha4m, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified..
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
   at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

【问题讨论】:

    标签: asp.net ajax web-services json


    【解决方案1】:

    尝试切换到 ASP.NET Web 应用程序项目。

    【讨论】:

      猜你喜欢
      • 2014-07-27
      • 2014-10-20
      • 1970-01-01
      • 2019-08-02
      • 2010-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多