473,657 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PreCompile Confusion

Hi. I'm very confused about what gets compiled to what, and what gets
cached where, and what gets persisted, and what is shared between
users. Could someone possibly check my understanding of the process
and tell me where I'm going wrong, and answer the following questions?
I think some clear answers would benefit a lot of people here:

At runtime, when a browser request comes in, the ASP.NET (.aspx) page
is converted dynamically into a (.cs) class file. All the C# code and
the HTML in the ASPX page becomes part of the class file. (The HTML
elements are stored in strings.) This entire file is then dynamically
compiled into a Microsoft Intermediate Language File having a .DLL
extension. This is a binary file, but it does not contain native
(machine) code. It contains MSIL code. After this compilation if
there were no compilation errors, the source (.cs) file is deleted.
Instead of executing the ASPX page, the CLR actually executes the code
in the compiled DLL file corresponding to the ASPX page. The compiled
DLL file is placed by ASP.NET into a special directory structure
within the Temporary ASP.NET Files directory. The MSIL (DLL) file is
then loaded into memory and methods in the file are invoked. As each
method is invoked the CLR just-in-time compiles the method from MSIL
into native machine code.

If user 1 requests a .aspx page (HomePage.aspx) , and invokes one of
the methods in that page (HelloWorld()), I understand that the .aspx
to .cs conversion will occur, and the .cs file will be compiled into a
DLL, and the DLL will be loaded into memory, and the HelloWorld()
method will be JITed into native machine code, and cached in memory,
so subsequent requests to the method will run more quickly.

Question 1. Let's say user 2, from a new browser, now requests the
same page and activates the same method. What benefit is there to
user 2? The conversion step from .aspx to .cs has already been
performed. And the compile from the .cs file to MSIL DLL step has
been performed. But what about the Just In Time compile of the
method? Does this have to be done again for user 2, since he is
running in a separate process space? Or is the Native code persisted
somewhere on disk or available somewhere in memory, such that user 2
can skip the JIT step also?

Question 2. Ngen.exe is used to pre-JIT a MSIL DLL file into a (?
extension) native machine file. But does Ngen.exe have anything to do
with the .aspx to .cs conversion step or the .cs to MSIL DLL step? Or
can I only Ngen the code behind file?

Question 3. Jeffrey Richter in his article at
"http://www.codeguru.co m/Csharp/.NET/net_general/toolsand3rdpart y/article.php/c4651/"
says "assemblies can be loaded in a domain-neutral or
non-domain-neutral fashion. NGen.exe produces code that assumes that
the only assembly loaded in a domain-neutral fashion is MSCorLib.dll
(which contains the definition for Object, Int32, String, and more).
If, at runtime, it is the case that other assemblies are loaded in a
domain neutral fashion, the CLR cannot use code produced by NGen.exe
and will resort to JIT compilation. For ASP.NET applications (Web
Forms and XML Web services), ***strongly-named*** assemblies are
always loaded in a domain-neutral fashion and therefore they gain no
performance benefit from having a corresponding NGen'd file."
Is this saying that ngen is useless for basically **ALL** ASP.NET
applications?

Question 4. Is there any utility or automated way to automatically
perform the .aspx to .cs conversion and the .cs to MSIL DLL step?
Nov 18 '05 #1
2 1680
Per Question 3: This seems to confirm that you cannot use NGEN with ASP.NET
dlls
http://support.microsoft.com/default...b;en-us;331979
--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Geoff" <ge*********@gm ail.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
Hi. I'm very confused about what gets compiled to what, and what gets
cached where, and what gets persisted, and what is shared between
users. Could someone possibly check my understanding of the process
and tell me where I'm going wrong, and answer the following questions?
I think some clear answers would benefit a lot of people here:

At runtime, when a browser request comes in, the ASP.NET (.aspx) page
is converted dynamically into a (.cs) class file. All the C# code and
the HTML in the ASPX page becomes part of the class file. (The HTML
elements are stored in strings.) This entire file is then dynamically
compiled into a Microsoft Intermediate Language File having a .DLL
extension. This is a binary file, but it does not contain native
(machine) code. It contains MSIL code. After this compilation if
there were no compilation errors, the source (.cs) file is deleted.
Instead of executing the ASPX page, the CLR actually executes the code
in the compiled DLL file corresponding to the ASPX page. The compiled
DLL file is placed by ASP.NET into a special directory structure
within the Temporary ASP.NET Files directory. The MSIL (DLL) file is
then loaded into memory and methods in the file are invoked. As each
method is invoked the CLR just-in-time compiles the method from MSIL
into native machine code.

If user 1 requests a .aspx page (HomePage.aspx) , and invokes one of
the methods in that page (HelloWorld()), I understand that the .aspx
to .cs conversion will occur, and the .cs file will be compiled into a
DLL, and the DLL will be loaded into memory, and the HelloWorld()
method will be JITed into native machine code, and cached in memory,
so subsequent requests to the method will run more quickly.

Question 1. Let's say user 2, from a new browser, now requests the
same page and activates the same method. What benefit is there to
user 2? The conversion step from .aspx to .cs has already been
performed. And the compile from the .cs file to MSIL DLL step has
been performed. But what about the Just In Time compile of the
method? Does this have to be done again for user 2, since he is
running in a separate process space? Or is the Native code persisted
somewhere on disk or available somewhere in memory, such that user 2
can skip the JIT step also?

Question 2. Ngen.exe is used to pre-JIT a MSIL DLL file into a (?
extension) native machine file. But does Ngen.exe have anything to do
with the .aspx to .cs conversion step or the .cs to MSIL DLL step? Or
can I only Ngen the code behind file?

Question 3. Jeffrey Richter in his article at
"http://www.codeguru.co m/Csharp/.NET/net_general/toolsand3rdpart y/article.ph
p/c4651/" says "assemblies can be loaded in a domain-neutral or
non-domain-neutral fashion. NGen.exe produces code that assumes that
the only assembly loaded in a domain-neutral fashion is MSCorLib.dll
(which contains the definition for Object, Int32, String, and more).
If, at runtime, it is the case that other assemblies are loaded in a
domain neutral fashion, the CLR cannot use code produced by NGen.exe
and will resort to JIT compilation. For ASP.NET applications (Web
Forms and XML Web services), ***strongly-named*** assemblies are
always loaded in a domain-neutral fashion and therefore they gain no
performance benefit from having a corresponding NGen'd file."
Is this saying that ngen is useless for basically **ALL** ASP.NET
applications?

Question 4. Is there any utility or automated way to automatically
perform the .aspx to .cs conversion and the .cs to MSIL DLL step?

Nov 18 '05 #2
Forgot to add, there are some homegrown pre-compilation tools:
http://www.codeproject.com/aspnet/AS...recompiler.asp

and this all changes with ASP.NET 2.0. It has built-in precompilation:
http://msdn.microsoft.com/library/de...ompilation.asp

--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Bryant Hankins" <bryanthankins@ _NO_SPAM_hotmai l.com> wrote in message
news:uw******** ******@TK2MSFTN GP09.phx.gbl...
Per Question 3: This seems to confirm that you cannot use NGEN with ASP.NET dlls
http://support.microsoft.com/default...b;en-us;331979
--
Hope this helps,
Bryant Hankins
Numinet Systems Inc.
http://www.numinet.com

"Geoff" <ge*********@gm ail.com> wrote in message
news:db******** *************** ***@posting.goo gle.com...
Hi. I'm very confused about what gets compiled to what, and what gets
cached where, and what gets persisted, and what is shared between
users. Could someone possibly check my understanding of the process
and tell me where I'm going wrong, and answer the following questions?
I think some clear answers would benefit a lot of people here:

At runtime, when a browser request comes in, the ASP.NET (.aspx) page
is converted dynamically into a (.cs) class file. All the C# code and
the HTML in the ASPX page becomes part of the class file. (The HTML
elements are stored in strings.) This entire file is then dynamically
compiled into a Microsoft Intermediate Language File having a .DLL
extension. This is a binary file, but it does not contain native
(machine) code. It contains MSIL code. After this compilation if
there were no compilation errors, the source (.cs) file is deleted.
Instead of executing the ASPX page, the CLR actually executes the code
in the compiled DLL file corresponding to the ASPX page. The compiled
DLL file is placed by ASP.NET into a special directory structure
within the Temporary ASP.NET Files directory. The MSIL (DLL) file is
then loaded into memory and methods in the file are invoked. As each
method is invoked the CLR just-in-time compiles the method from MSIL
into native machine code.

If user 1 requests a .aspx page (HomePage.aspx) , and invokes one of
the methods in that page (HelloWorld()), I understand that the .aspx
to .cs conversion will occur, and the .cs file will be compiled into a
DLL, and the DLL will be loaded into memory, and the HelloWorld()
method will be JITed into native machine code, and cached in memory,
so subsequent requests to the method will run more quickly.

Question 1. Let's say user 2, from a new browser, now requests the
same page and activates the same method. What benefit is there to
user 2? The conversion step from .aspx to .cs has already been
performed. And the compile from the .cs file to MSIL DLL step has
been performed. But what about the Just In Time compile of the
method? Does this have to be done again for user 2, since he is
running in a separate process space? Or is the Native code persisted
somewhere on disk or available somewhere in memory, such that user 2
can skip the JIT step also?

Question 2. Ngen.exe is used to pre-JIT a MSIL DLL file into a (?
extension) native machine file. But does Ngen.exe have anything to do
with the .aspx to .cs conversion step or the .cs to MSIL DLL step? Or
can I only Ngen the code behind file?

Question 3. Jeffrey Richter in his article at

"http://www.codeguru.co m/Csharp/.NET/net_general/toolsand3rdpart y/article.ph p/c4651/"
says "assemblies can be loaded in a domain-neutral or
non-domain-neutral fashion. NGen.exe produces code that assumes that
the only assembly loaded in a domain-neutral fashion is MSCorLib.dll
(which contains the definition for Object, Int32, String, and more).
If, at runtime, it is the case that other assemblies are loaded in a
domain neutral fashion, the CLR cannot use code produced by NGen.exe
and will resort to JIT compilation. For ASP.NET applications (Web
Forms and XML Web services), ***strongly-named*** assemblies are
always loaded in a domain-neutral fashion and therefore they gain no
performance benefit from having a corresponding NGen'd file."
Is this saying that ngen is useless for basically **ALL** ASP.NET
applications?

Question 4. Is there any utility or automated way to automatically
perform the .aspx to .cs conversion and the .cs to MSIL DLL step?


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1518
by: Bernard Dhooghe | last post by:
DB2 UDB V8.1 Fixpak 4 AIX 5.1 CLASSPATH: /usr/opt/db2_08_01/java/db2jcc.jar:/usr/opt/db2_08_01/java/db2jcc_license_cu.jar:/usr/opt/db2_08_01/java/sqlj.zip:/usr/java131/jre/lib/rt.jar: Program: tmp0.sqlj import java.sql.*; import sqlj.runtime.*; import sqlj.runtime.ref.*;
1
1164
by: gladiator | last post by:
Hello EveryOne: I am in a ASP.NET team,developping web appplications.What does "precompile the web form" means ? we have a plenty of assemblys in the project,does the above method make sense to save time?If i want turn off just-in-time compilation after deploying the web application.how to do it?i do not want recompile everything before debugging. Additional advice or resource is more helpful. Thanks in advance...
1
1715
by: Steve Franks | last post by:
Hi - I'm using VS.NET 2005 and have read about this precompile.axd that supposedly can be hit with a browser to force a complete recompile on the production server. However I do not have this .axd file. Where can I get it and how is it installed? Also what is to prevent an outside users from hitting this a bunch of times on purpose? Steve
8
1524
by: Mike Owen | last post by:
Hi, I am trying to pre-compile a project prior using ASP.Net 2.0, VS 2005, to putting it onto a live server. The reason for doing this is that other people have access to the server, and I thereofre want to keep the code secure. If I use the 'Build/Publish Web Site' option, it asks me to tell it the 'Target location' which in this case is 'C:\Temp\PrecompiledWeb\Project1'
0
3339
by: cjeschke | last post by:
Using PRO*C precompiler on windows, I precompile my c code with embedded Oracle 9.2 queries. When I link the program including all the Oracle 9.2 libraries I can find, i get an undefined _sqlcxt: >make gcc -oreplaceCard.exe -lm -LC:\oracle\ora92\precomp\lib -LC:\oracle\ora92\oci\lib\msvc -IC:\oracle\ora92\oci\include -IC:\oracle\ora92\precomp\public replaceCard.c c:/djgpp/tmp/ccsIViCl.o(.text+0x58a):replaceCard.c: undefined reference to...
2
1797
by: Shimon Sim | last post by:
I tried to use Precompile.axd to compile my site but got HTTP404 (The resource cannot be found) instead. I am running ASP.NET Version:2.0.50727.42 .. Any suggestions? Thank you, Shimon.
1
1739
by: Tessa | last post by:
Hi, Is there a way to use aspnet_compiler to precompile an existing asp.net 2.0 web application that is on another server? I need to initiate the precompile programmatically from another .net windows program running on a different machine. thanks for any info
7
3116
by: bruce barker | last post by:
a previous long thread brought this up. I can find no way to precompile a web application from visual studio. by precompile I mean all the aspx code is converted to assemblies by visual studio, not at runtime by asp.net. if you view the compiled aspx page it should only contain the line: This is a marker file generated by the precompilation tool, and should not be deleted!
3
2009
by: Scott M. | last post by:
Scenario: ASP .NET 2.0 Web "Site" All but one page is written using inline VB .NET code. One page is written using VB .NET code-behind. MSBuild options are set at the default (allow pages to be updateable) When I "publish" the site and take a look at the precompiled folder that is generated by this process, I see a /bin folder has been created with one file in it "App_Web_pccpykfu.dll".
1
171
by: Gabriel Pineda | last post by:
hi everybody, i have an issue for you: i have an operative site wich i'm trying to precompile to protect the code that will be installed on client. the issue is: if i run the precompile (aspnet_compiler) it throw me some errors: ex: Name 'CN' is not declared. this is because the variable es declared in another page, that includes the one which throw the error. how can i bypass these "errors" ? how can i precompile the site? is it...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.