NGen ASP.NET to save memory - Native Image not used - asp.net

We have a web application which we host, where we deploy the same application to 100+ "tenants" on the same machine(s).
Managed DLL's memory is not shared between processes by default, that means we load the same DLL 100+ times into memory. Goal is to avoid this, and NGen seems to be the way to go for this, as it specifically allows this to happen.
The ASP.NET application is pre-compiled and all DLL's have been NGen'ed, but it seems that they are not used.
Fusion Log Viewer gives us the following output:
* Assembly Binder Log Entry (20.06.2017 # 16:53:11) *
The operation was successful. Bind result: 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.
=== 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.
=== LOG: IL assembly loaded from E:\Temporary ASP.NET Files\itemservice\081f93f5\fd860966\assembly\dl3\08cf29cf\00893e3e_afe9d201\SD.LLBLGen.Pro.ORMSupportClasses.dll.
* Assembly Binder Log Entry (20.06.2017 # 16:53:11) *
The operation was successful. Bind result: 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.
=== 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.
=== LOG: IL assembly loaded from E:\Temporary ASP.NET Files\itemservice\081f93f5\fd860966\assembly\dl3\08cf29cf\00893e3e_afe9d201\SD.LLBLGen.Pro.ORMSupportClasses.dll.
As you can see it does not load the native image from C:\Windows\assembly\NativeImages_v4.0.30319_64...
Using:
NGen display "SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral, 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.
All rights reserved.
NGEN Roots:
\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\WS\bin\SD.LLBLGen.Pro.ORMSupportClasse
s.dll
Native Images:
SD.LLBLGen.Pro.ORMSupportClasses, Version=5.1.0.0, Culture=neutral,
PublicKeyTok en=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. 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.
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

Related

ASP.Net Razor App - OAuth somehow got into app, can't get it out

Sounds strange, I know... and I've poured over every post I could find relating to this :( However, my website worked just fine and then all of the sudden it is failing on:
Could not load file or assembly 'DotNetOpenAuth.Core, Version 4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the asembly reference. (Exception from HResult: 0x80131040).
I don't see any references to it at all in the project and it has never used authentication ever. What is the lowest level I can get to in order to find out where it is trying to call this assembly and remove it?
It's frustrating as heck... I know it is because I'm not an every-day programmer - so maybe its easy to find, but I have looked over hundreds of posts here and elsewhere trying to resolve and nothing has worked so far :(
I also grabbed an unused reference tool called ResolveUR to try to do it... still same result :(
FYI - I'm using Visual Studio 2013 for this one because Installshield LE is part of it and that was how the application was initially deployed.
Thanks in advance!
** ADDED error I get from page **
=== Pre-bind state information ===
LOG: DisplayName = DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
(Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/MedsAdmin/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\MedsAdmin\bin
Calling assembly : Microsoft.Web.WebPages.OAuth, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/medsadmin/4efeacc2/d291dc53/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/medsadmin/4efeacc2/d291dc53/DotNetOpenAuth.Core/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MedsAdmin/bin/DotNetOpenAuth.Core.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
* EDIT: Replaced Old Web.Config *
Somehow my web.config file got written over - so that is the reason for the OpenAuth issue.
NOW: It seems to be trying to load MySQLMembershipProvider from my machine.config file (which fails). Why is it doing this?

Could not load file or assembly xxx or one of its dependencies. An attempt was made to load a program with an incorrect format

I have checked all similar questions but no solution worked for me:
I have my web application build properties set to: Any CPU for all configurations. (I have also tried all combinations) - that is what mostly solved the problem in similar questions.
Also in app pool I have 32 bit application set to TRUE.
I run my web site on IIS 7.5
My web application is build without and error, but when i run it i get the following error from log:
*** Assembly Binder Log Entry (23.3.2016 # 9:51:19) ***
The operation failed.
Bind result: hr = 0x8007000b. An attempt was made to load a program with an incorrect format.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = SM.EORD.Web
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: SM.EORD.Web | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/Documents/Projekti/TFSProd/eOrdering/Main/Source/SM.EORD/SM.EORD.Web/
LOG: Initial PrivatePath = D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\eorddev\883938bb
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\eorddev\883938bb
LOG: AppName = ad349442
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\web.conf ig
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/eorddev/883938bb/ad349442/SM.EORD.Web.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/eorddev/883938bb/ad349442/SM.EORD.Web/SM.EORD.Web.DLL.
LOG: Attempting download of new URL file:///D:/Documents/Projekti/TFSProd/eOrdering/Main/Source/SM.EORD/SM.EORD.Web/bin/SM.EORD.Web.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\bin\SM.EORD.Web.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: SM.EORD.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b).
ERR: Setup failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
*** Assembly Binder Log Entry (23.3.2016 # 9:51:19) ***
The operation failed.
Bind result: hr = 0x8007000b. An attempt was made to load a program with an incorrect format.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = SM.EORD.Web
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: SM.EORD.Web | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/Documents/Projekti/TFSProd/eOrdering/Main/Source/SM.EORD/SM.EORD.Web/
LOG: Initial PrivatePath = D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\eorddev\883938bb
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\eorddev\883938bb
LOG: AppName = ad349442
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/eorddev/883938bb/ad349442/SM.EORD.Web.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/eorddev/883938bb/ad349442/SM.EORD.Web/SM.EORD.Web.DLL.
LOG: Attempting download of new URL file:///D:/Documents/Projekti/TFSProd/eOrdering/Main/Source/SM.EORD/SM.EORD.Web/bin/SM.EORD.Web.DLL.
LOG: Assembly download was successful. Attempting setup of file: D:\Documents\Projekti\TFSProd\eOrdering\Main\Source\SM.EORD\SM.EORD.Web\bin\SM.EORD.Web.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: SM.EORD.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
ERR: Invalid assembly platform or ContentType in file (hr = 0x8007000b).
ERR: Setup failed with hr = 0x8007000b.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Any idea?
br, Simon

Discrepancy between framework versions for MVC2 app

I'm working with an MVC2 app that had migrated from an MVC1 app quite a while ago. Things have been working - i've been able to compile and deploy a number of iterations without any problems (...yeah right...but not problems relevant to _this question...)
I've noticed that the version info - that bit in the footer of runtime errors - i've received during the normal course of development reads:
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
despite the fact that the project's Properties | Application tab shows the target framework to be .net 3.5. I _think 3.5 is required for mvc2 apps, isn't it?
Shouldn't I expect to see runtime error pages pointing to version info at the 3.5 version?
UPDATE: As that this isn't a simple matter of a framework mismatch, here's the error - but given other factors, I'll assume I need to repair/refresh the workstation's framework installs. The same code works on another ws.
=== Pre-bind state information ===
LOG: User = STUDIO11\steve
LOG: DisplayName = System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///_mvc2/foo/
LOG: Initial PrivatePath = C:\_mvc2\foo\bin
Calling assembly : App_Web_enim_j6d, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\_mvc2\foo\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
thx
It's a bit complicated, but essentially the version you are seeing is the version of the CLR runtime. The 2.0, 3.0, and 3.5 releases of .NET share the same CLR runtime. If MVC runs then everything is fine.

ASP.NET DLL Partial Binding Error

I am running into the following error when running my ASP.NET application. I am running this using IIS 6.0 on WinXP 64. The assembly is signed and thus needs a strong name, but apart from adding a reference and using the functions in the dll, I don't know how to resolve the error. I have tried installing the assembly in the GAC, but that did not help.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = random
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: random.dll | Domain ID: 10
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Root/Server/
LOG: Initial PrivatePath = C:\Root\Server\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Root\Server\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/server/aeb22d03/3a6c0025/random.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/server/aeb22d03/3a6c0025/random/random.DLL.
LOG: Attempting download of new URL file:///C:/Root/Server/bin/random.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
The issue was resolved by enabling .NET v4.0 64 bit ISAPI extensions. The 32 bit extensions were enabled by default.

website compile error

I am experiencing the following error while loading a website:
Server Error in '/DatingGridView' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 52:
Line 53:
Line 54:
Line 55:
Line 56:
Source File: D:\VSProjects\DatingGridView\web.config Line: 54
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information ===
LOG: User = PassionFruit-PC\PassionFruit!!!
LOG: DisplayName = System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///D:/VSProjects/DatingGridView/
LOG: Initial PrivatePath = D:\VSProjects\DatingGridView\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\VSProjects\DatingGridView\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions/System.Web.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/Users/PassionFruit!!!/AppData/Local/Temp/Temporary ASP.NET Files/datinggridview/5a514f00/39d65547/System.Web.Extensions/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions.EXE.
LOG: Attempting download of new URL file:///D:/VSProjects/DatingGridView/bin/System.Web.Extensions/System.Web.Extensions.EXE.
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Your error clearly states:
Could not load file or assembly 'System.Web.Extensions'
Check that you are referencing this in your project and that your .NET framework is installed correctly.
System.Web.Extensions is required for MS Ajax and will appear in your D:\VSProjects\DatingGridView\web.config to enable the correct handlers for ASP.Net 2.0 (comes built in for 3.5). If you haven't installed the MS Ajax Extensions on the machine where you are running this site you'll have the kind of error you've posted.

Resources