assembly loading

  • Thread starter Thread starter RickN
  • Start date Start date
R

RickN

We have a C# remoting application that runs thru the web. Assemblies appear
to be loaded from the download cache. Is there any way to have them
automatically copied to the GAC and be loaded from there: for performance
reasons and to be applicable machine wide. We'd also like to be able to use
an installation package to pre-load all the dll's and don't see how an
installation program can pre-loaded them into the
download cache.
Thanks,
RickN
 
Assemblies must be installed, not copied, to the GAC, and there is no way to
have the runtime automatically do this for you when an assembly is
downloaded from a website, nor would anyone want it to.

If you are using an installation program that you can run on your client
machine then you can install those assemblies into the GAC (not the download
cache) at installation time.

BTW: if the assembly needs to be machine wide then the GAC is the
appropriate place for it, but if performance is the reason then I would not
put it in the GAC. If all you need is for the assembly to be present when
the application program runs then putting it into the application base
directory is sufficient.
 
As I understand it, when a remoting application runs, it checks to see if it
has the most current version of the dll, if not it downloads it to the
download cache and then loads it from the download cache. So, as I
understand it, if it exist in the download cache, it isn't even going to
look in the application directory, as you suggest. I also understand that
files loaded from the cache must go thru a security check and files loaded
from the GAC, do not. Therefore, I don't understand why you say I would not
want to load from the GAC for performance reasons.
Please explain.
Thanks,
RickN
 
RickN said:
As I understand it, when a remoting application runs, it checks to see if it
has the most current version of the dll, if not it downloads it to the
download cache and then loads it from the download cache. So, as I
understand it, if it exist in the download cache, it isn't even going to
look in the application directory, as you suggest. I also understand that
files loaded from the cache must go thru a security check and files loaded
from the GAC, do not. Therefore, I don't understand why you say I would not
want to load from the GAC for performance reasons.
Please explain.
Thanks,
RickN

You are mixing together a number of different topics. This article explains
some of the issues.

http://msdn.microsoft.com/msdnmag/issues/02/07/NetSmartClients/

I did not state that you would not want to load from the GAC for performance
reasons, what I said was that performance by itself is not a sufficient
reason to put assemblies into the GAC. Files loaded from the GAC go through
a security check that same as any other assembly; all assemblies use Code
Access Security, it's just that assemblies in the GAC typically are granted
more permissions then assemblies downloaded from a website.

You asked was about copying files to the GAC - you cannot copy files there,
the files must be installed, and files installed into the GAC must be signed
with a strongname. The GAC is not the same as the download cache. The
download cache can be located anywhere, is usually unique per logged-in
user, and has no strongname requirements. The download cache can be cleared,
deleted, etc.; it is just a temporary repository - the GAC is permanent.

Signing assemblies has an effect on how versioning works. You should read up
on this and plan accordingly.

You indicated that you could run an installation program; this implies that
you could install your application anywhere onto the client's machine at
that time, so you could create a directory for your application and put your
assemblies into that directory - this is what I meant when I referred to the
application base directory.
 
Back
Top