Thursday, March 14, 2013

Choosing Between the Bin or Global Assembly Cache


Within a SharePoint site, you can deploy a Web Part assembly to one of two locations:
  • Bin directory: Stored in your Web application root directory.
  • Global assembly cache: Automatically installed with the common language runtime. Enables you to share assemblies across numerous applications. Components are typically stored in C:\WINNT\Assembly. 
Each location has advantages and disadvantages, as described in the following table.
Deployment location
Advantages
Disadvantages
Bin directory
A partial trust location. By default, code that runs from this directory has a low level of code access security permissions. Administrator must explicitly raise permissions granted to a Web Part so it can function properly. Because of this level of control and defense-in-depth, administrators tend to prefer that assemblies they get can run in the bin directory, with a known set of required code access security permissions.
A Bin directory is also specific to a Web application. This makes it possible to isolate code to a particular Web application.
To run your Web Part everywhere, you must deploy your Bin assembly.
Global assembly cache
A global location where you can deploy signed assemblies. Assemblies run with full trust by default. They are installed globally, so they work in any Web application.
Generally, there are no code access security restrictions on code installed to the global assembly cache; therefore, you lose the defense-in-depth security benefit.
Also, it can be difficult to deploy your .PDB files (program databases) to assemblies in the global assembly cache.

No comments:

Post a Comment