Monday, March 31, 2014

Differebce between Sandboxed solution and Farm Solution in SharePoint

In this post we will discuss about what is difference between Sandboxed Solutions and Farm Solutions in SharePoint.

Also you can check out:

- Create a sequential workflow using Visual studio 2010 in SharePoint 2010

- Enable Sign in as Different User Option in SharePoint 2013

- SharePoint 2013 JavaScript Client Object Model Example

The sandbox is a separate process in which a SharePoint solution runs in isolation. Sandboxed solutions are managed through a new Solution Gallery at the site collection level. Also Visual Studio 2010 can deploy solutions directly to the sandbox during development. The User Code Service is responsible for managing the execution of sandboxed solutions across the farm. Sandboxed solutions are deployed directly to a site collection.

Both Sandboxed and Farm Solutions are packaged and built in same manner. The difference is with deployment target and the functionality available to the solution at run time.

Any SharePoint solution that can be deployed as a sandboxed solution can also be deployed as a farm solution.

In Visual Studio 2010, When the Sandboxed Solution property is set to True, selecting Build\Deploy Solution deploys
the solution to the site collection Solution Gallery. This new gallery is the repository for all sandboxed solutions deployed within the site collection.

Main difference between the deployment methods are: Farm solutions are installed and deployed. Sandboxed solutions are uploaded and activated. The install step in a farm deployment is similar to the upload step in a sandboxed deployment. The deploy step in a farm deployment is similar to the activate step in a sandboxed deployment. The one notable difference is that the activation of a sandboxed solution automatically activates any feature scoped to the level of the site collection.

When the Sandboxed Solution property is set to False, selecting Build\Deploy will deploy the solution to the Farm Solution Gallery.

The sandbox approach allows the site collection administrator to upload the solution and deploy it without involving the farm administrator.

Sandboxed solutions also support feature upgrading. Upgrading is accomplished by creating a solution (.wsp) file with a different name but the same solution Id. When you subsequently deploy the new solution version, SharePoint will see that the Id matches an existing solution and prompt you to upgrade the solution. Once upgraded, the old solution is automatically deactivated.

Apart from this check out some more differences:

Farm Solutions:
- Farm solutions are hosted in the IIS worker process (W3WP.exe).

- If you run any code in farm solution the whole farm will got affected.

- If you deploy any feature or retract any feature the whole application pool got recycled.

- Since they are scoped as farm level, they have full trust access to all the resources.

- When the Sandboxed Solution property is set to False, selecting Build\Deploy will deploy the solution to the Farm Solution Gallery.

Sandboxed Solution:
- Sandboxed solutionsare hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe).

- The process runs under a CAS policy that restricts programmatic access to any resource outside the sandbox. So it never restart the IIS application pool.

- If you run any code it will affect only the site collection of the solution.

- Helpful if you have shared hosting.

- When the Sandboxed Solution property is set to True, selecting Build\Deploy Solution deploys the solution to the site collection Solution Gallery.


Twitter Delicious Facebook Digg Favorites More