Pre-jit-compiling MVC Web Application - asp.net-mvc

When using our MVC Web Application after it is updated, it takes several minutes to load the homepage for de first time. After the first load it loads pretty fast. Probably the MSIL code is compiled to Native Machine code and is cached. (Correct me if i'm wrong). This occures for every page.
Everytime a new version is copied over to the server it is very slow.
To solve this problem i was trying to get it pre-jit-compiled with ngen so we could save lots time for our users.
However when executing "ngen install mydll.dll" for every dll in it's project bin folder, it gives me several errors. This is the command
cd "C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
for %%i in (C:\inetpub\wwwroot\myproject\bin\*.dll) do ngen install "%%i"
The first errors are:
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)
The project just debugs and builds fine. What is the correct way to achieve this?

You would have to warm-up the initialization of your web application. This will speed-up the load of the homepage for the first time. To give you a brief conceptual overview:
1)The worker process is not spawned until the first request is made to the website . The Worker Process is associated with Application Pool. The spawning of the worker process can be time taking process, as the process initiates the web site. So the first step is to spawn the worker process in advance (w3wp.exe). This can be done at the application pool level
2)With the first request to the website; the worker process loads all the application DLL's to execute the request. This process of loading the dll's can be time taking. Also, when App Pool is recycled , the worker process has to again reload all the application dlls. So the second step is to pre-load the dll's by the worker process.. This can be done at the website level.
The application warm-up module is a built in feature in IIS 8.0.
Please follow below links to warm-up your web application in IIS:
http://technet.microsoft.com/en-us/video/microsoft-virtual-academy-ii8-application-initialization.aspx
http://blogs.msdn.com/b/amol/archive/2013/01/25/application-initialization-ui-for-iis-7-5.aspx
http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
http://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET-Apps-alive

Related

Could not load file or assembly 'Microsoft.SharePoint.ApplicationPages.Administration' or one of its dependencies

When I want to the access SharePoint 3.0 Central Administration, web page gives the following error:
An error occurred during the processing of . Could not load file or assembly 'Microsoft.SharePoint.ApplicationPages.Administration' or one of its dependencies. The system cannot find the file specified.
I put the Microsoft.SharePoint.ApplicationPages.Administration.dll and Microsoft.SharePoint.ApplicationPages.dll files to the GAC.
I also tried restarting the IIS and recycling the application pools but it did not work.

MVC4-Deployment "Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0"?

I am trying to deploy a simple intranet application on my local machine. I've included the deployable assemblies and have deployed it in asp.netv4 app pool but when I try to browse the application i get the below error.
Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The system cannot find the file specified
Could anyone please help ? thanks
The first thing you should do is to go to your MVC web application project and expand the References node in the project tree. Select the DotNetOpenAuth assemblies and in the Properties dialog, set Copy Local to True. and then deploy it.
MVC.NETProject->References->Remove OAuth*

Grails - trying to deploy a nojars application into glassfish 3.0.1

Because of memory constraint i am trying to build a grails app with smaller memory footprint. I build the war with this argument "--nojars". I created a war file without all the jar and when i deploy within the glassfish i encounter this error
Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.web.util.Log4jConfigListener
It seems like the application fail to find where is the jar file.
I had already indicates the path to the library before deploying the application in glassfish.
did i miss out somethinng?
It is commonly recommended to use GlassFish's Common Classloader. That means putting the shared JARS into the $domain-dir/lib folder (but not into a subfolder of that).
You're probably trying to use the Application Classloader with the asadmin deploy --libraries command. This is more complicated and error-prone. If you don't need different versions of the same JARs with different web applications, you should definitely go for the Common Classloader as specified above.
Also see The Classloader Hierarchy for a reference.
EDIT Updated as per the questioner's comment:
The domain/domain1/lib folder definitely works (I've tested that). To validate that, put log4j.jar into that folder and add a test.jsp to domain1/applications/$applicationName, that just contains:
<% out.println(
org.apache.log4j.Logger.getLogger(this.getClass())); %>
If that works but your other code does not, there may be another point to consider: Are you using Log4J's Logger.getLogger(..) or Apache Commons' LogFactory.getInstance(..) in your code?
See the article Taxonomy of class loader problems encountered when using Jakarta Commons Logging for related issues. - I'd also like to advise you to post your complete stacktrace.

azure developement fabric dll hell

Hello I am trying to package and start up azure developement fabric on a windows 2008 server, I am so close yet still far. The steps I take are
1) run cspack.exe command /copyOnly to generate the .csx folder
2) run csrun.exe commmand /LaunchBrowser to start up the developement fabric and startup the browser
the error is as follows
System.BadImageFormatException: Could
not load file or assembly
'Interop.SSCE' or one of its
dependencies. An attempt was made to
load a program with an incorrect
format.
== Pre-bind state information === LOG: User = IP-0AE2B2DF\Administrator LOG:
DisplayName = Interop.SSCE (Partial)
LOG: Appbase =
file:///C:/Users/Administrator/Documents/Visual
Studio
2010/Projects/MyAzureProject/src/AzureCloudService/ServiceDefinition.csx/roles/MyAzureProject.Web/approot/
LOG: Initial PrivatePath =
C:\Users\Administrator\Documents\Visual
Studio
2010\Projects\MyAzureProject\src\AzureCloudService\ServiceDefinition.csx\roles\MyAzureProject.Web\approot\bin
Calling assembly : (Unknown).
=== LOG: This bind starts in default load context. LOG: Using application
configuration file:
C:\Users\Administrator\Documents\Visual
Studio
2010\Projects\MyAzureProject\src\AzureCloudService\ServiceDefinition.csx\roles\MyAzureProject.Web\approot\web.config
LOG: Using host configuration file:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file
from
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\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:/Users/Administrator/AppData/Local/dftmp/s0/deployment(98)/res/deployment(98).AzureCloudService.MyAzureProject.Web.0/aspNetTemp/aspNetTemp/root/dfbc079a/82bed8d5/Interop.SSCE.DLL.
LOG: Attempting download of new URL
file:///C:/Users/Administrator/AppData/Local/dftmp/s0/deployment(98)/res/deployment(98).AzureCloudService.MyAzureProject.Web.0/aspNetTemp/aspNetTemp/root/dfbc079a/82bed8d5/Interop.SSCE/Interop.SSCE.DLL.
LOG: Attempting download of new URL
file:///C:/Users/Administrator/Documents/Visual
Studio
2010/Projects/MyAzureProject/src/AzureCloudService/ServiceDefinition.csx/roles/MyAzureProject.Web/approot/bin/Interop.SSCE.DLL.
ERR: Failed to complete setup of
assembly (hr = 0x8007000b). Probing
terminated.
this error happens with 2 dlls Interop.SSCE.DLL and SqlLite.dll Ive replaced all references to SqLite dll with a 64bit version and I dont have any references anymore to Interop.SSCE.DLL since I am not using it. Manually deleting these assemblies from the location
"C:\Users\Administrator\Documents\Visual Studio
2010\Projects\MyAzureProject\src\AzureCloudService\ServiceDefinition.csx\roles\MyAzureProject.Web\approot\bin"
solves the issue, but I dont obviously want to manually delete these everytime as I trying to automate a build process. My question is then how is the .csx folder actually generated and will this give me clues as to where these dll's are bring copied from? This is really frustrating as with the exception of those dll errors, I =m able to package the solution and startup the developement fabric with no other problems. Please Help!!
I realize this is old, but I just ran across it while trying to solve the same problem. In my case, the issue was that some of my projects were set to build x86 assemblies, instead of Any CPU. The solution was:
Go to Build -> Configuration Manager
Make sure "Active solution platform" is set to "Any CPU"
Make sure each of the projects also has the "Platform" set to "Any CPU"
Rebuild
Go to:
Tools > Options > Projects and Solutions > Web Projects
Check the Use the 64 bit version of IIS Express for web sites and projects.
This will ensure that your web project runs in x64 mode and will thus be able to use Service Fabric files.
Hope it helps...

ASP.NET MVC 2.0 Prev 1 and SPARK?

I am trying to upgrade the ASP.NET MVC 1.0 application to 2.0 preview 1. I am using the spark as view engine.
issue:
Spark used the System.Web.MVC 1.0.0.0 so I got the source code and recompiled using the 2.0.0.0 and used the new assembly. Now I am getting the different error as follows:
Could not load file or assembly 'Microsoft.Web.Mvc' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Mvc' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 163: return new ViewEngineResult(searchedLocations);
Line 164:
Line 165: entry = Engine.CreateEntry(descriptor);
Line 166: SetCacheValue(descriptorParams, entry);
Line 167: return BuildResult(entry);
Source File: C:\Data\Projects\Samples\spark 1.0 Src\src\Spark.Web.Mvc\SparkViewFactory.cs Line: 165
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Web.Mvc' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
My experience:
Get Spark source from this link: Spark development builds
Replace the file bin\aspnetmvc\System.Web.Mvc.dll with the 2.0 version (from %ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies)
Execute the build.cmd script
The updated Spark.dll & Spark.Web.Mvc.dll are available in the build folder
Notes:
on the time of writing, the available spark development version is 1.0.39961.0.
The build script fails while looking for a jsunit file (I believe) but the DLLs are generated properly before it breaks. Just cancel its execution by hitting Ctrl+C when the error is displayed otherwise it'll retry the operation.
Hope it helps.

Resources