Chapter 8 – Building Sandbox Solutions

Wrox Reall World Sharepoint 2010 (P.247)

Code Access Security (CAS) – a set of policies that control which functions can be performed by code based on a set of identification criteria. They don’t apply to assemblies in GAC. All Assemblies in GAC are automatically granted full CAS.

With a sandbox solution, the site administrator can deploy the solutions in solution gallery. Default for a sanbox solution execution is 60 seconds.

All of the resources used by the sandbox solutions are tracked, these resources are assigned points, and ultimately the system administrator allocates a maximum set of points to s site collections.

The resource quota is set at the site collection’s
level. Once the site collection reaches its quota of resource points, the solution in the site collection are shut down for the remainder of the day. You can chose to execute the SS in local or remote.

SPUCHostService.exe User Code Service, runs sandbox solutions. You can also define the CAS for the application pool.

Query (Resource) Throttling
– set at the Web Application level, prevents a query from running if they will return more than 5,000 rows.
(1) Administrator have a different quota that applies to them.
(2) Administrator can switch off the throttling feature (in list settings)
(3) “Happy Hour”

Resource Throttling – Central Admin Manage Web Application

Two restrictions with Sanbox Solutions
(1) CAS policy
(2) process token. (P.255)

Creating a Sandbox Project in VS 2010 —

In VS 2010, new project, Sharepoint à Empty Sharepoint Project à Sandbox Solution

Right click HelloWorld in Solution Explorer, and add a new Item
à Web Part à
Named HelloWorldWebPart

In VB Source:

F5 to run the app.

Change to Edit Mode, insert the Web Part.

So it’s working – a literal control

VS 2010 automatically creates a feature and package (*.WSP) for you.

From the solutions page you can see all solutions deployed to the server.

Going Out of the Sandbox —
To get out of the “sandbox solution” box, use a proxy application. And register the proxy with Sharepoint.
Implementing a proxy is a matter of overriding two classes – (1) argument class and (2) operations

argument class must derive from SPProxyOperationArgs and must be serializable.
operations class must derive from SPProxyOperation. Both need to be in GAC.

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: