Sandboxed Solutions Share Point 2010

One of the most common causes of system instability in SharePoint farms is custom code. As you’ve seen in a few of the examples in this chapter, it’s pretty easy to make coding errors that can quickly destroy the performance of a server. To provide administrators with more control over the custom code that runs on a farm, SharePoint 2010 introduces the concept of a sandboxed solution. As the name suggests, a sandboxed solution is a custom code solution that runs in an isolated sandbox. From an administrative perspective, a number of configurable options are available for sandboxed solutions, such as specifying resource quotas and monitoring performance. These options are beyond the scope of this, but, from our perspective as developers, we need to know a few things about sandboxed solutions.

Sandboxed solutions run in a separate process, whereas other types of solutions run directly within the appropriate SharePoint process. In addition to running in a separate process, sandboxed solutions can utilize only a subset of the SharePoint Object Model. A custom code access security (CAS) policy is applied to prevent sandboxed code from performing actions that could jeopardize system stability.

As you’ll see in the examples throughout this book, when you’re creating a new SharePoint project using Visual Studio, you’ll see an option to select a sandboxed solution or a farm solution. Bearing in mind that sandboxed solutions have access only to a subset of the SharePoint API, when you deploy as a sandboxed solution option, Visual Studio IntelliSense displays assistance only for objects and members that are available. Having said that, there is a catch: although IntelliSense doesn’t provide assistance for inaccessible members, it is still possible to write code using them. Such code will compile and deploy fine but will throw an error at runtime.

Debugging Sandboxed Solutions
As mentioned, sandboxed solutions run under a separate process. To debug such solutions, you need to connect to the SPUCWorkerProcess.exe process manually using the Debug | Attach to Process option in Visual Studio.

Managing Sandboxed Solutions
Sandboxed solutions are managed from the Solutions Gallery, which is maintained at the site collection level. To access the Solutions Gallery from any site, take the following steps:

  1. From the Site Actions menu, select Site Settings.
  2. On the Site Settings page, if it’s available, select Go To Top Level Site Settings.
  3. Click the Solutions link in the Galleries section.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Share Point 2010 Topics