简体   繁体   English

NGen ASP.NET以节省内存-未使用本机映像

[英]NGen ASP.NET to save memory - Native Image not used

We have a web application which we host, where we deploy the same application to 100+ "tenants" on the same machine(s). 我们有一个托管的Web应用程序,其中将同一应用程序部署到同一台计算机上的100多个“租户”。 Managed DLL's memory is not shared between processes by default, that means we load the same DLL 100+ times into memory. 默认情况下,进程之间不共享托管DLL的内存,这意味着我们将相同的DLL加载了100多次以上。 Goal is to avoid this, and NGen seems to be the way to go for this, as it specifically allows this to happen. 我们的目标是避免这种情况,而NGen似乎就是这样做的方法,因为它特别允许这种情况发生。

The ASP.NET application is pre-compiled and all DLL's have been NGen'ed, but it seems that they are not used. ASP.NET应用程序已经过预编译,并且所有DLL都经过了NGen的编译,但是似乎没有使用它们。

Fusion Log Viewer gives us the following output: Fusion Log Viewer为我们提供了以下输出:

* Assembly Binder Log Entry (20.06.2017 @ 16:53:11) * *装配活页夹日志条目(20.06.2017 @ 16:53:11)*

The operation was successful. 操作成功。 Bind result: hr = 0x0. 绑定结果:hr = 0x0。 The operation completed successfully. 操作成功完成。

Assembly manager loaded from: C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\clr.dll Running under executable c:\\windows\\system32\\inetsrv\\w3wp.exe --- A detailed error log follows. 从以下位置加载程序集管理器:C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ clr.dll在可执行文件c:\\ windows \\ system32 \\ inetsrv \\ w3wp.exe下运行---详细的错误日志如下。

=== Pre-bind state information === LOG: DisplayName = SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27 (Fully-specified) LOG: Appbase = file:///E:/WebHotel/tenant/ItemService/ LOG: Initial PrivatePath = E:\\WebHotel\\tenant\\ItemService\\bin LOG: Dynamic Base = E:\\Temporary ASP.NET Files\\itemservice\\081f93f5 LOG: Cache Base = E:\\Temporary ASP.NET Files\\itemservice\\081f93f5 LOG: AppName = fd860966 Calling assembly : Product.Core.Library, Version=2.5.12456.0, Culture=neutral, PublicKeyToken=null. ===预绑定状态信息===日志:DisplayName = SD.LLBLGen.Pro.ORMSupportClasses,Version = 5.1.0.0,Culture = neutral,PublicKeyToken = ca73b74ba4e3ff27(完全指定)LOG:Appbase = file:/// E:/ WebHotel / tenant / ItemService /日志:初始PrivatePath = E:\\ WebHotel \\ tenant \\ ItemService \\ bin日志:动态基础= E:\\ Temporary ASP.NET文件\\ itemservice \\ 081f93f5日志:缓存基础= E:\\ Temporary ASP.NET Files \\ itemservice \\ 081f93f5日志:AppName = fd860966调用程序集:Product.Core.Library,Version = 2.5.12456.0,Culture = neutral,PublicKeyToken = null。 === LOG: IL assembly loaded from E:\\Temporary ASP.NET Files\\itemservice\\081f93f5\\fd860966\\assembly\\dl3\\08cf29cf\\00893e3e_afe9d201\\SD.LLBLGen.Pro.ORMSupportClasses.dll. ===日志:从E:\\ Temporary ASP.NET Files \\ itemservice \\ 081f93f5 \\ fd860966 \\ assembly \\ dl3 \\ 08cf29cf \\ 00893e3e_afe9d201 \\ SD.LLBLGen.Pro.ORMSupportClasses.dll加载的IL程序集。

* Assembly Binder Log Entry (20.06.2017 @ 16:53:11) * *装配活页夹日志条目(20.06.2017 @ 16:53:11)*

The operation was successful. 操作成功。 Bind result: hr = 0x0. 绑定结果:hr = 0x0。 The operation completed successfully. 操作成功完成。

Assembly manager loaded from: C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\clr.dll Running under executable c:\\windows\\system32\\inetsrv\\w3wp.exe --- A detailed error log follows. 从以下位置加载程序集管理器:C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ clr.dll在可执行文件c:\\ windows \\ system32 \\ inetsrv \\ w3wp.exe下运行---详细的错误日志如下。

=== Pre-bind state information === LOG: DisplayName = SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27 (Fully-specified) LOG: Appbase = file:///E:/WebHotel/tenant/ItemService/ LOG: Initial PrivatePath = E:\\WebHotel\\tenant\\ItemService\\bin LOG: Dynamic Base = E:\\Temporary ASP.NET Files\\itemservice\\081f93f5 LOG: Cache Base = E:\\Temporary ASP.NET Files\\itemservice\\081f93f5 LOG: AppName = fd860966 Calling assembly : Product.Core.Library, Version=2.5.12456.0, Culture=neutral, PublicKeyToken=null. ===预绑定状态信息===日志:DisplayName = SD.LLBLGen.Pro.ORMSupportClasses,Version = 5.1.0.0,Culture = neutral,PublicKeyToken = ca73b74ba4e3ff27(完全指定)LOG:Appbase = file:/// E:/ WebHotel / tenant / ItemService /日志:初始PrivatePath = E:\\ WebHotel \\ tenant \\ ItemService \\ bin日志:动态基础= E:\\ Temporary ASP.NET文件\\ itemservice \\ 081f93f5日志:缓存基础= E:\\ Temporary ASP.NET Files \\ itemservice \\ 081f93f5日志:AppName = fd860966调用程序集:Product.Core.Library,Version = 2.5.12456.0,Culture = neutral,PublicKeyToken = null。 === LOG: IL assembly loaded from E:\\Temporary ASP.NET Files\\itemservice\\081f93f5\\fd860966\\assembly\\dl3\\08cf29cf\\00893e3e_afe9d201\\SD.LLBLGen.Pro.ORMSupportClasses.dll. ===日志:从E:\\ Temporary ASP.NET Files \\ itemservice \\ 081f93f5 \\ fd860966 \\ assembly \\ dl3 \\ 08cf29cf \\ 00893e3e_afe9d201 \\ SD.LLBLGen.Pro.ORMSupportClasses.dll加载的IL程序集。

As you can see it does not load the native image from C:\\Windows\\assembly\\NativeImages_v4.0.30319_64 ... 如您所见,它不会从C:\\Windows\\assembly\\NativeImages_v4.0.30319_64加载本机映像...

Using: NGen display "SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27" 使用:NGen显示“ SD.LLBLGen.Pro.ORMSupportClasses,版本= 5.1.0.0,区域性=中性,PublicKeyToken = ca73b74ba4e3ff27”

gives us: 给我们:

C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319>ngen display "SD.LLBLGen.Pro.ORM SupportClasses, Version=5.1.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff2 7" Microsoft (R) CLR Native Image Generator - Version 4.6.1087.0 Copyright (c) Microsoft Corporation. C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319> ngen显示“ SD.LLBLGen.Pro.ORM SupportClasses,版本= 5.1.0.0,区域性=中性,PublicKeyToken = ca73b74ba4e3ff2 7” Microsoft(R)CLR本机图像生成器-版本4.6.1087.0版权所有(c)Microsoft Corporation。 All rights reserved. 版权所有。

NGEN Roots: NGEN根:

\\server\\e$\\Template\\2.5.12456.0\\ItemService\\bin\\SD.LLBLGen.Pro.ORMSuppor NGEN Roots that depend on "SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Cu lture=neutral, PublicKeyToken=ca73b74ba4e3ff27": \\ server \\ e $ \\ Template \\ 2.5.12456.0 \\ ItemService \\ bin \\ SD.LLBLGen.Pro.ORMS支持NGEN根目录,这些根目录取决于“ SD.LLBLGen.Pro.ORMSupportClasses,版本= 5.1.0.0,版本=中性,PublicKeyToken = ca73b74ba4e3ff27" :

\\server\\e$\\Template\\2.5.12456.0\\WS\\bin\\SD.LLBLGen.Pro.ORMSupportClasse s.dll \\ server \\ e $ \\ Template \\ 2.5.12456.0 \\ WS \\ bin \\ SD.LLBLGen.Pro.ORMSupportClasse s.dll

Native Images: 本机图像:

SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral, PublicKeyTok en=ca73b74ba4e3ff27 SD.LLBLGen.Pro.ORMSupportClasses,Version = 5.1.0.0,Culture = neutral,PublicKeyTok zh = ca73b74ba4e3ff27

Not sure if this is the issue, but c:\\windows\\system32\\inetsrv\\w3wp.exe seems to be a 32-bit executable, and you're using the 64-bit ngen.exe . 不知道这是否是问题,但是c:\\windows\\system32\\inetsrv\\w3wp.exe似乎是32位可执行文件,并且您正在使用64位ngen.exe If your app is 32-bit, you'll need to use the 32-bit ngen.exe , or the 64-bit w3wp.exe if it's the other way around. 如果您的应用是32位的,则需要使用32位的ngen.exe或64位的w3wp.exe如果不是这样)。

If this is not the issue, you may want to check this blog post (if you haven't already): 如果这不是问题,则可能要检查此博客文章(如果尚未查看):
https://kceiw.me/net-native-image-troubleshooting https://kceiw.me/net-native-image-troubleshooting

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM