奇怪和随机发生的程序集未找到错误

时间:2011-07-25 23:54:24

标签: asp.net ajax web-services json

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

在localhost上:在visual studio中编程/编辑aspx页面并在浏览器中查看结果时,编辑aspx页面的次数为5-6次,然后开始失败。直到我进入我的Web服务接口类做一些事情(比如在某处放一个换行符)并重新编译它。问题得到解决,循环继续......

当我在火灾中追踪失败的请求时,我发现了500个内部服务器错误:  [FileNotFoundException:无法加载文件或程序集'App_Web_lbgnha4m,Version = 0.0.0.0,Culture = neutral,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)

1 个答案:

答案 0 :(得分:0)

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