ASP .Net compliation

J

Jack Wright

Dear All,
We have developed a few Web pages in .Net and have a number to
dlls in our bin directory...in our Global.asmx on Application_Start we
have written code to load each library from the bin directory...using
Assembly.Load(...).
Even if I comment this function...the CLR compiles all the dlls in the
bin directory and puts it in "ASP Temporary Internet files"
folder...does this mean that Assembly.Load is not necessary? Also if
my bin had around 200 dlls does it make the first time access slow?
Is there any information how MSIL works?

Please help

Many Regards
Jack
 
M

Madan Nayak

Hi..
The use of Refection API in .Net is to dynamically load the dlls at run
time.
If at design time you donot know the dlls to be included in the perticular
module, then you can go for the assembly.load..

Otherwise you can simply add reference and work. the assembly are loaded in
to memeory only whwn your code needs to invoke any class. Even if your whole
class is not loaded into memory, rather when the methods are called the
perticular methos is loaded to the call stack and then jitted in native
code.

I think you have created a web service. I donot know what exactly your
problem is. Why do you need to laod the assemblies in the Application start
global event in your web service. CAn you tell more elaboratly
my bin had around 200 dlls does it make the first time access slow?

No.
As I had said earlier, the number of dlls donot slow any application.
It is always advisable to break down the dlls to give a faster loading of
dlls into memory.

Hope to listen from you
Thanks
Madan
 
J

Jack Wright

Dear Madan,
Thanks for replying...I am loading the dlls on Application_Startup
to make my applications fast...
But even if I comment this function why does CLR convert all the dlls
present in bin directory to MSIL...I checked this in the "Temporary
ASP.NET Files" folder...
One more and strange observation was:
1. If my Virtual directory is more than 8 chars
2. There are around 255 dlls in the bin

I do a random copy of the dlls...I get a vbc compiler error 2000...after
I remove around 20 dlls and run any aspx page it works...later I put the
20 dlls back and it still works...

What is going wrong here? any ideas...

Thanks & Regards
Jack
 
A

Alvin Bruney [MVP]

It's necessary but not in your instance. As a rule of thumbs, only common
assemblies should go in the root bin because as you see, they are always
loaded by the framework. Calling assembly load will just return in this case
because the assembly is already loaded.

Place only common assemblies shared across applications in the bin. Other
assemblies go in the applications bin folder. For example, you have two
applications A.aspx and B.aspx. Both of these applications use assembly C.
but only B uses assembly D. Put assembly C in c:\inetpub\wwwroot\bin or
whatever root is pointing to. C gets automatically loaded. Put D in the bin
folder beneath application B or c:\inetpub\wwwroot\B\bin. Your code would be
modified to load assembly D since the default is to load assembly C. Makes
sense?

hth
 
A

Alvin Bruney [MVP]

It's necessary but not in your instance. As a rule of thumbs, only common
assemblies should go in the root bin because as you pointed out, they are
always
loaded by the framework. Calling assembly load will just return in this case
because the assembly is already loaded.

Place only common assemblies shared across applications in the bin. Other
assemblies go in the applications bin folder. For example, you have two
applications A.aspx and B.aspx. Both of these applications use assembly C.
but only B uses assembly D. Put assembly C in c:\inetpub\wwwroot\bin or
whatever root is pointing to. C gets automatically loaded. Put D in the bin
folder beneath application B or c:\inetpub\wwwroot\B\bin. Your code would be
modified to load assembly D since the default is to load assembly C. Makes
sense?


hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top