我在ASP.NET项目中遇到过此错误消息,但是这个最新的实例让我感到困惑,因为在我的项目中找不到任何对ReportViewer的引用。寻找有关如何确定其来源的任何建议。下面是堆栈跟踪信息:
[FileNotFoundException: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +457
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +729
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +69
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +321
System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +878
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +124
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +700
答案 0 :(得分:0)
许多Asp.Net控件需要报表查看器库的支持才能呈现输出。因此,尝试安装包Microsoft Report Viewer Redistributable,然后尝试编译解决方案。您可能已在安装过程中或以后无意中将其删除。
您还可以尝试去检查GAC [C:\ Windows \ assembly]文件夹中是否列出[Microsoft.ReportViewer.WebForms]和相关程序集。如果没有在那里找到它,那么它清楚地表明工作站中没有隐式依赖项。
答案 1 :(得分:0)
虽然我无法确定为什么会出现上述错误,但我发现了一种解决方法,即将一堆程序集从此服务器上的其他工作应用程序复制到项目的\ bin文件夹中。这些集合包括:
Microsoft.ReportViewer.*
Microsoft.AI.Web
Microsoft.ApplicationInsights
Microsoft.AspNet.*
......还有其他几个人。它仍然困扰我为什么这甚至是必要的,因为代码不仅适用于我的开发机器,而且还有我第一次部署它的另一个测试Web服务器。如果我的项目没有可验证的引用,但仍然依赖于它们,那么我希望发布工具应该确保这些依赖项与我的其余代码一起部署。