Ads

Friday, 13 November 2015

Difference between assemblies present in bin folder vs GAC


  • <Assembly DeploymentTarget="GlobalAssemblyCache" Location="MyCompiledClass.dll">   ->  added MyCompiledClass as assembly to GAC
  • <Assembly DeploymentTarget=" WebApplication" Location="MyCompiledClass.dll">   ->  added MyCompiledClass.dll to bin directory

GAC:
Runs with full trust
Key point is dlls in the GAC (Global Assembly Cache) have full privileges. dll's in the bin have restricted privileges.
Certain tasks such as timer jobs, workflows, service applications and event receivers only work in the GAC.
Allows for multiple versions of the dll to exist in the GAC provided versioning is used. 
Assemblies deployed to the GAC available to all of the web applications

Bin:
Deploying to the bin minimises permissios
runs with the trust level specified for the web application (standard or custom CAS policy).
Can change the level of permissions for dll's in the bin using CAS policies. (Code Access Security)
SharePoint has 2 policys/ Trust levels default: WSS_Minimal or WSS_Medium (same options as in MOSS)
Can also use ASP.NET's policies, there are about 5 of these policies in .NET and the highest level is the "Full Trust" CAS policy. ( Full, High, Medium, Low, Minimal)
Change the CAS relating to you dll's in the bin via your applications web.config.
Only code that runs in the IIS workprocess can be placed in the bin.
Bin deployment can't have multiple versions.
Assemblies deployed to the bin folder are local to the given web application
The trust levels are defined in security policy files, wss_minimaltrust.config and wss_mediumtrust.config. 
Location: local_drive:\Program Files\Common Files\Microsoft Shared\web server extensions\60\config 

Refer : oneTwo 

If deployed in one web application BIN folder and want to extend/ deploy to another web application:

No comments:

Post a Comment

Ads