修复以下问题:System.Web.HttpException:该文件尚未预编译,无法请求 [英] Fix for : System.Web.HttpException: The file has not been pre-compiled, and cannot be requested

查看:85
本文介绍了修复以下问题:System.Web.HttpException:该文件尚未预编译,无法请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们发布了网站,一切正常.几天后,发生了一些奇怪的事情.

We published our website and everything worked fine. After few days, something strange happened. we're getting "The file 'xxx.cshtml' has not been pre-compiled, and cannot be requested."

重置应用程序池,甚至重新启动IIS也无法帮助我们解决问题.即使重置Web服务器计算机也无法解决问题.但是当我们再次重新复制已发布的文件时,该网站再次开始工作.我们将有问题的网站文件与新文件进行了比较,所有文件都是相同的.什么都没有丢失.因此,每隔两三天,我们会收到相同的错误,而解决该错误的唯一方法是再次重新复制文件.

Resetting application pool, even restarting IIS didn’t help us to resolve the problem. Even resetting the Web server machine didn't fix the problem. but when we re-copying the published files again, web site starts working again. We compared the problem website files with the new files, all are the same. nothing is missing. so every two-three days, we are getting the same error and the only way we can fix it is recopying the files again.

当我们遇到错误时,我们甚至复制了网站,然后根据这些文件创建了另一个网站,它运行良好!有什么建议可以导致此问题吗?

We even copied website when we got an error and then create another website based on those files and it works fine! Any suggestion what can cause this problem?

提前谢谢.

推荐答案

关于错误

System.Web.HttpException:该文件尚未预编译,因此无法请求在web.config中指定引用时,将出现此错误,并且部署文件夹/站点不包含安装在系统或bin文件夹不包含它们(如果它们是私有的组件).例如:(add assembly ="Namespace1.NameSpace2,版本= x.x.x.x,文化=中性,PublicKeyToken = 31bf3856ad364e35"/)如果您的web.config包含任何这样的程序集并已部署服务器在bin或GAC中不包含这些可配置文件,则此错误将会发生.

System.Web.HttpException: The file has not been pre-compiled, and cannot be requested This error will come when a reference is specified in web.config and deployment folder/site does not contain these dlls installed in the system or bin folder does not contain them(if they are private assemblies). For Example: (add assembly="Namespace1.NameSpace2, Version=x.x.x.x, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/) if your web.config contains any assemblies like this and deployed server doesnot contain these assembiles in bin or GAC, then this error will occur.


场景:

以下是一些可能会产生此错误的情况:


Scenarios:

Here are some possible scenarios that will generate this error:

  1. 当我们发布带有可更新"的网站时,请选中关闭",然后在部署位置复制一些文件,其中包含一些标记或代码.经过取消可更新"检查后,我们指示asp.net编译器将所有标记和代码编译为dll文件,以便进一步在asp.net上不考虑内容的运行时编译.但是,如果需要(由于存在此类内容),则会抛出该错误.

  1. When we publish the website with the "updateable" check OFF and then copy some files on deployment location that has some markup or code in them. By putting the "updateable" check OFF we instruct the asp.net compiler to compile all the markup and code into dll files so that further on asp.net would not consider runtime compilation of content. But if it needs to (due to the presence of such content) it will throw that error.

第二种情况是当我们在VS.Net直接在IIS(http项目)上运行,然后我们将其再次发布到同一位置,并且选中可更新".在同一位置会有开发文件,这将导致类似的错误.

The second situation is when we have a web application configured in VS.Net to run directly off IIS (the http project) and then we publish it to the same location again with the "updateable" checked OFF. There will be development files at same location which will cause similar errors.

另一种情况是,我们有一个预编译的网站,并且在它的根文件夹中,我们还有另一个文件夹,其中包含另一个asp.net的内容应用程序,但未在IIS中标记为应用程序.ASP.Net跟踪asp.net在IIS上运行时,将IIS中的虚拟目录标记为应用程序.子文件夹在父文件夹中具有未编译的内容预编译的应用程序将再次导致此错误.

Another situation is where we have a precompiled website and within the root folder of it we have another folder that has content for another asp.net application but isn¡¯t marked as application in IIS. ASP.Net tracks asp.net applications when running on IIS by virtual directories in IIS marked as applications. A child folder having un-compiled content within a parent application which is precompiled will again cause this error.

来源:Microsoft支持

显然,这是另一种情况,其原因与缺少ReportViewer .dll引用有关

Apparently, it is another scenario where the cause is related to missing ReportViewer .dll references

  • 有人谈论手动添加丢失的缺少的程序集文件.
  • Some people talks about adding manually the missing missing assembly files.

我发现一件事,即在发布应用程序时它确实不复制bin文件夹中的所有相关程序集.所以我只是手动将它们复制到服务器,现在一切正常

i found out one thing that while publishing the application it does not copy all of the dependent assemblies in the bin folder.So i just copied them manually to the server and now every thing is working

  • 其他人,以某种方式修复了此安装程序"Microsoft Web Service增强功能v3.0".在此处下载.它可能提供缺少的必需.dll

    • Other people, somehow fixed this installing "Microsoft Web Service Enhancements v3.0". Downlaod here. It probably provides missing required .dll

      此处,有人对其进行了修复,启用了创建单独的程序集每个页面和控件输出"中的部署选项"

      Here, somebody fixed it, enabling "Create a separate assembly for each page and control output" in the Deployment Options

      这篇关于修复以下问题:System.Web.HttpException:该文件尚未预编译,无法请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆