更新后使用我们的 MVC Web 应用程序时,第一次加载主页需要几分钟时间。第一次加载后,它加载得非常快。可能 MSIL 代码被编译为本地机器代码并被缓存。(如我错了请纠正我)。这发生在每一页上。
每次将新版本复制到服务器时,速度都很慢。为了解决这个问题,我尝试使用 ngen 对其进行预jit 编译,这样我们就可以为用户节省大量时间。但是,当为其项目 bin 文件夹中的每个 dll 执行“ngen install mydll.dll”时,它给了我几个错误。这是命令
cd "C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
for %%i in (C:\inetpub\wwwroot\myproject\bin\*.dll) do ngen install "%%i"
第一个错误是:
Failed to load dependency System.Web.Mvc of assembly DotNetOpenAuth.Core,
Version=4.3.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246 because of the following error : The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Failed to load dependency log4net of assembly DotNetOpenAuth.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246 because of the following error : The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
该项目只是调试和构建良好。实现这一目标的正确方法是什么?