Visual Studio 中的“发布”选项是否被视为 ASP.net Web 应用程序的预编译?

发布于 2024-10-22 16:35:34 字数 118 浏览 10 评论 0原文

我无法理解该网站何时被视为“预编译”。据我了解我所读到的内容,如果我使用 Visual Studio 中的发布或构建部署包选项,那么它是预编译的,但如果我只是使用 xcopy 之类的东西,那么它不是预编译的。这是正确的吗?

I'm having trouble understanding when the site is considered "pre-compiled". As I understand what I've read, if I use the Publish or Build Deployment Package options from within Visual Studio then it is pre-compiling, but if I just use something like xcopy, then it is not pre-compiled. Is that correct?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏见 2024-10-29 16:35:34

ASP.NET 网站项目有一个 xcopy 部署选项,其中所有文件(包括 aspx、aspx.cs、ascx、ascx.cs 等)都按原样复制到生产 Web 服务器。 ASP.NET 运行时在收到第一个请求时编译站点。如果检查文件夹 C:\Windows\Microsoft.NET\Framework\v\Temporary ASP.NET Files,您可以看到输出。这显然非常容易部署,因为我们所要做的就是将文件复制到 Web 服务器。然而,第一个访问者根据网站第一次编译的时间付费。发布选项在部署之前执行此工作。它编译网站项目并生成可供运行的程序集。发布中有一个选项可以将 aspx 文件保留原样,以便可以对其进行修改。在这两种情况下,都没有 .cs 文件,因为这些文件已编译到程序集中。检查演练:发布网站了解更多详情。

华泰

ASP.NET WebSite projects have an option of xcopy deployment in which all files including the aspx, aspx.cs, ascx, ascx.cs etc are copied to the production web server as is. The ASP.NET runtime compiles the site when it receives the first request. If you check the folder C:\Windows\Microsoft.NET\Framework\v\Temporary ASP.NET Files, you could see the output. This obviously is very easy for deployment as all we have to do is to copy the files over to the web server. However, the first visitor pays the price in terms of when the site gets compiled for the first time. The publish option does this work before the deployment. It compiles the website project and produces assemblies that are ready to run. There is an option in the publish to leave the aspx files as is so that those can be modified. In both cases there are no .cs files as those have been compiled to the assemblies. Check Walkthrough: Publishing a Web Site for more details.

HTH

泪意 2024-10-29 16:35:34

它是“编译”的,因为您将拥有 Web 代码的 MSIL DLL。但是,您仍然需要进行 JIT 编译。如果您使用 .NET 2.0 或更高版本,则应使用 NGEN 实用程序来避免出现此预热时间。请注意,NGEN 仅适用于消除应用程序的首次“启动”时间。它确实使维护变得更加困难,因为 JIT 代码可能与 NGEN 代码不同步。在我的企业环境中,由于这些潜在的陷阱,我们选择不使用 NGEN。

请参阅以下链接:

将 NGEN 用于 ASP.NET 应用程序有帮助吗?

有关 NGEN 实用程序的 Microsoft 文档

使用 NGEN 的潜在陷阱

It is "compiled" in the sense that you will have a MSIL DLL of your web code. However, you will still have to have the JIT compilation. You should use the NGEN utility if you are using .NET 2.0 or greater to prevent this warm-up time. Please note, NGEN is only useful to eliminating the first "startup" time of the application. It does make it harder to maintain because JIT'ed code can get out of sync with NGEN'd code. In my enterprise environment, we chose not to use NGEN because of those potential pitfalls.

See the links below:

Does it help to use NGEN for ASP.NET Applications?

Microsoft Documentation on NGEN utility

Potential Pitfalls of using NGEN

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文