c# - 是否可以在已停止的 IIS 6 站点上预编译 ASP.Net 网站?

标签 c# .net asp.net compiler-construction iis-6

我在 IIS 上有 2 个站点,一个是事件站点,另一个是仅在事件站点进行维护时才启动的站点。

在部署场景中,我停止实时站点并启动维护站点,以便用户收到一条友好的升级建议消息。

我遇到的唯一问题是,当我启动实时站点时,它显然必须进行 JIT,这最多可能需要 3 分钟。

在我将它释放给用户之前是否有任何 JIT?

编辑:澄清一下,这个网站是一个 CMS,所以下面标记的答案对我有用,因为只有 1 页要编译。

谢谢

最佳答案

看来您需要使用 NGen...

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.

预编译网站进行部署,使用固定名称,将解决方案部署到服务器,然后ngen bin中的所有程序集

MSDN article on NGen .

我应该补充一点,通过像这样预生成 native 代码,您可能会失去运行时根据当前系统性能(例如内存和寄存器使用)执行的一些优化。这甚至可能导致站点运行速度低于 JIT 运行速度。 Microsoft 建议您在接近正常使用条件下的条件下,在目标平台上尝试 NGen 和 JIT 方法。

关于c# - 是否可以在已停止的 IIS 6 站点上预编译 ASP.Net 网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3203506/

相关文章:

c# - 对同一类型的多个对象进行大量操作

.net - SignalR 有效负载是否不可知?

c# - 背景 worker 一次性争论

c# - 如何在客户端连接时通知 WCF 服务的主机?

C#:图表:从收到的 UDP 数据包中放入数据的最快方法

c# - 如何在 C# 中手动使用 PKCS5 (RFC 1423) 填充进行 AES 解密?

c# - Common.Logging 包更新与 Log4Net 不兼容

asp.net - IE 不保存 asp.net 身份验证 token /cookie

javascript - 如何在不使用 Ajax 的情况下在 ASP.NET 2.0 中的 C# 代码执行过程中打开 showModalDialog

c# - 适用于 .NET 开发的 Windows 7