|
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Typically, when you create a Visual Studio .NET application, any assembly references by default that are not part of the GAC (Global Assembly Cache) are copied to the project's output directory (same directory as the compiled EXE or DLL). In ASP.NET, the \bin directory of the application's Virtual Directory in IIS is searched for assembly references to load that are also not part of the GAC. If you do not want to use a component/distributed architecture using XML Web Services or the Remoting classes in the .Net framework then you may want to learn how to load an assembly from a remote application server. To do this you need to accomplish two things:
I do NOT recommend loading assemblies remotely. Instead, add an assembly to the GAC or application's \bin directory on the computer where the application is to run. Or, better yet, use XML Web Services and/or Remoting classes in the framework for a distributed architecture instead. When using XML Web Services and Remoting classes you still need to maintain copies of remote assemblies: one for the remote machine (aka, application server, e.g., Web Services, Remoting process) for serving the assembly and one for providing a reference to the consuming application (e.g., Windows Forms, ASP.NET).REMEMBER: We are dealing with 2 VS.NET projects here: (Project #1) the project containing the strong-named assembly and (Project #2) the project containing the application that is to consume the strong-named assembly. Project #2 can be wither a Windows Forms or ASP.NET (Web Forms) application.
NOTE: What we have done here is both create a strong-named assembly and told an application where to
load a particular assembly from . In ASP.NET you normally don't need to add a refernce to an assembly in
web.config as most of the assemblies used are either loaded from the GAC or the Virtual
Directory's \bin directory. However, when you want to load an assembly remotely you need to
a an explicit reference to that directory or add it the assembly to the GAC so that the
metadata of that assembly can be readily available to the CLR upon compilation of the
Window Form or ASP.NET applcation.
You can copy the assembly to the ASP.NET application's \bin directory or the GAC but then you would consistently have to update both the remote assembly and the local assembly (causing DLL hell!). In ASP.NET, I add a reference to the web.config file that points to a strong-name assembly in GAC on that ASP.NET (IIS) computer like this: |
|||||||||||||||||||
|
COPYRIGHT/DISCLAIMER | CONTACT US |
||||||||||||||||||||