473,503 Members | 1,735 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.com/Csharp/.NET/net_general/toolsand3rdparty/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 1675
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*********@gmail.com> wrote in message
news:db**************************@posting.google.c om...
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.com/Csharp/.NET/net_general/toolsand3rdparty/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_hotmail.com> wrote in message
news:uw**************@TK2MSFTNGP09.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*********@gmail.com> wrote in message
news:db**************************@posting.google.c om...
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.com/Csharp/.NET/net_general/toolsand3rdparty/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
1511
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:...
1
1154
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...
1
1696
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...
8
1515
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...
0
3326
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: ...
2
1791
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
1731
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...
7
3102
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,...
3
1997
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...
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...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5005
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...
0
4670
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...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
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 ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.