Sandboxed Solutions in Sharepoint 2010

Have been looking at Sharepoint 2010 last few days and came across Sandboxed Solutions. I have been working on a BPOS project last few months, and my experience on it makes me believe sandboxed solutions are something that will be highly encouraged in BPOS (they are encouraged in other environments as well but i am just saying it will be very much applicable to BPOS given the security and administration advantages Sandboxed solutions provide).

I wont be explaining much about Sandboxed solutions here, there are already a host of good articles on it,  i will list a good one at the end, for more you can just bing. I will just summarise a few things here

Sandboxed solutions run within a more restricted and secured environment than the normal solutions. They run in a process seperate from w3p.exe which is the SPUCWorkerProcess.exe. Due to the increased security there are some restrictions on what the sandboxed solutions can do which are described here https://msdn.microsoft.com/en-us/library/ff872402.aspx#InsideSP14_Ch4_USR. There is also good blog by Sahil Malik which indicates a list of things to note while creating webparts as sandboxed solutions - https://blah.winsmarts.com/2009-12-You_can_deploy_WebParts_as_Sandboxed_solutions__but.aspx . One thing i will like to add to this list is that you cannot create visual webparts (the ones that have an ascx file) using sandbox solutions since because you cannot deploy files to web front ends using these type of solutions.

The  way sandboxed solutions differ from normal / farm solutions is only in the manner in which they are deployed which makes it really easy to upgrade them to a farm solution with lesser security restrictions if needed. Sandboxed solution are deployed to the  _catalogs/solutions document library of your site collection. To upgrade them to the farm solution you just need to deploy the wsp to you farm. The fact that sandboxed solutions run in a seperate process from w3p.exe ensures that the code in the deployed solution will have an isolated impact increasing the availabilty of you sharepoint application. One more important point to note is that along with being more secure sandboxed solutions are more easily monitored and since they are deployed to a site collection these reduce the overhead on the IT administrator of your sharepoint farm.

Given all these advantages it looks obvious to build most of the sharepoint solutions as sandboxed solutions. In fact we must build sharepoint solutions as farm solutions only if they cannot be run as sandboxed solutions.

The following link by Paul Stubbs will give a great bit of detail about sandboxed solutions
https://msdn.microsoft.com/en-us/magazine/ee335711.aspx