Thursday, January 2, 2014

Sandbox Solution vs Farm Solution

Sandbox solution is a new feature introduced in SharePoint 2010.When you are creating any SharePoint solution using Visual Studio, you are  select the  solution which is either a Sandboxed solution or a farm solution.


Sandboxed Solution

 we should learn what is a Sandbox. A sandbox is a testing environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment. Basically what it does is sandbox isolates untested code from the working environment.
So when we are deploying a solution as a sandboxed solution, the solution  cannot access content outside the site collection they are deployed in. The sandboxed solution will not be able to use certain computer and network resources. Since the sandboxed solution is scoped to the site collection, we don’t really need a farm administrator to deploy the solution. A site collection administrator can do the deployment.

Farm Solution

  In farm solutions can have scope as wide as the site collection, web application, or the whole SharePoint farm. Since Farm solutions can be scoped to Farm level, we need a Farm Administrator to deploy the solution and the assemblies in the solution always run with full trust.

Farm solutions are are hosted in the IIS worker process (W3WP.exe) and the code in the farm solutions can affect the whole farm. When you try to retract or deploy a farm solution, the whole application pool will be recycled.
Farm solutions should be used for customizations of SharePoint administrative functions, such as custom timer jobs, custom Windows PowerShell cmdlets, & extensions of Central Administration.