380 likes | 635 Views
Required Slide. SESSION CODE: OSP308. Developing with Microsoft SharePoint Server 2010 Sandboxed Solutions. Scot Hillier scot@shillier.com Scot Hillier Technical Solutions, LLC. Code for Today’s Session. http://hillier.codeplex.com http://sandbox.codeplex.com. Agenda.
E N D
Required Slide SESSION CODE: OSP308 Developing with Microsoft SharePoint Server 2010 Sandboxed Solutions Scot Hillier scot@shillier.com Scot Hillier Technical Solutions, LLC
Code for Today’s Session http://hillier.codeplex.com http://sandbox.codeplex.com
Agenda • Why do we need Sandboxed Solutions? • What is the Sandbox? • How does the Sandbox work? • How do I build a Sandboxed Solution? • What are the restrictions on a Sandboxed Solution? • Can I get out of the Sandbox when necessary? • How are Sandboxed Solutions managed?
How to Enrage SP IT Pros • Ask them to change the production farm trustLevel to Full. • Ask them to make hand edits to the web.config files in the production farm. • Forget to compile your production code in Release mode. • Forget to run SPDisposeCheck against your assemblies before deployment. • Tell them everything has to go in the GAC.
Sandboxed Solutions – Why? Security & Stability BusinessAgility Totally Agile Business • Simple deployment model • Limited restrictions on developer access to farm • All resources are available to solutions • Iterative development process
Sandboxed Solutions – Why? Security & Stability BusinessAgility Totally Stable & Secure • ‘Clean Room’ Datacenter • 3 week change control process • Formal code review • Severe restrictions on resource access
Sandboxed Solutions – Why? Security & Stability BusinessAgility Essential Agility Essential Stability • Easy deployment • Iterative development • Safe • Limited API Access • Monitored
Supported Solutions • Content Types, Site Columns • Custom Actions • Declarative Workflows • Event Receivers, Feature Receivers • InfoPath Forms Services (not admin-appr)JavaScript, AJAX, jQuery, Silverlight • List Definitions • Non-visual web parts • Site Pages • SharePoint OnLine
Key Limitations • Sandboxed Solution runs in sandbox. Other artifacts like lists and declarative workflows run with full trust because they have no code. • User identity is lost when running in the sandbox • Business Connectivity Services requires Secure Store Service if identity is required • Must run worker process as managed account to use SSS • Script Manager, Page-level variables, web-part connections unavailable because solution doesn’t really run on the page.
The Sandbox • A separate process where the solution runs • Exposes a subset of Microsoft.SharePoint • Code Access Security policy limits functionality • Site Collection Solution Gallery for deployment • Central Administration for managing and monitoring solutions
A Separate Process • User Code Service(SPUCHostService.exe) • Sandbox Worker Process(SPUCWorkerProcess.exe) • Sandbox Worker Process Proxy(SPUCWorkerProcessProxy.exe)
A Subset of Microsoft.SharePoint • Microsoft.SharePointExcept • SPSite constructor • SPSecurity object • SPWorkItem and SPWorkItemCollection objects • SPAlertCollection.Addmethod • SPAlertTemplateCollection.Add method • SPUserSolution and SPUserSolutionCollection objects • SPTransformUtilities • Microsoft.SharePoint.Navigation • Microsoft.SharePoint.UtilitiesExcept • SPUtility.SendEmail method • SPUtility.GetNTFullNameandEmailFromLogin method • Microsoft.SharePoint.Workflow • Microsoft.SharePoint.WebPartPagesExcept • SPWebPartManager object • SPWebPartConnection object • WebPartZone object • WebPartPage object • ToolPane object • ToolPart object
Code Access Security Policy • SharePointPermission.ObjectModel • SecurityPermission.Execution • AspNetHostingPermission.Level = Minimal Note: Several approaches can be used to “break out” of the Sandbox
Solution Gallery • Site Collection Library • Located at _catalogs/solutions • Upload, activate, deactivate
Central Administration • Solution Administration • Block Solutions • Quota Templates • Resource Monitoring
Basics Creating Sandboxed Solutions DEMO
Sandbox Architecture FRONT END HOST SERVER Execution Manager(Inside Application Pool) Host Services (SPUCHostService.exe) Worker Service (SPUCWorkerProcess.exe) IIS(WPW3.EXE) Untrusted Code Subset Object Model Proxy Microsoft.SharePoint.dll
Sandbox Architecture FRONT END HOST SERVER Execution Manager(Inside Application Pool) Host Services (SPUCHostService.exe) Worker Service (SPUCWorkerProcess.exe) IIS(W3WP.EXE) Untrusted Code Subset Object Model Proxy Subset-Model Request Microsoft.SharePoint.dll
Sandbox Architecture FRONT END HOST SERVER Execution Manager(Inside Application Pool) Host Services (SPUCHostService.exe) Worker Service (SPUCWorkerProcess.exe) IIS(W3WP.EXE) Untrusted Code Subset Object Model Proxy Full-Model Request Microsoft.SharePoint.dll
Sandbox Architecture FRONT END HOST SERVER Execution Manager(Inside Application Pool) Host Services (SPUCHostService.exe) Worker Service (SPUCWorkerProcess.exe) IIS(W3WP.EXE) • while(true) • { • //Do a Bad Bad Thing! • } Run for 30sec Untrusted Code Subset Object Model Proxy Resource Wasting Call Microsoft.SharePoint.dll
Full-Trust Proxy Worker Service (SPUCWorkerProcess.exe) GAC SPProxyOperationsArgs SPProxyOperationsArgs SPProxyOperation SPUtility SecuredResource
Client-Side Solutions Worker Service (SPUCWorkerProcess.exe) Silverlight App Silverlight Web Part Host Uncustomized Page JavaScript Web Service (or Client OM) SecuredResource
Breaking-Out of the Sandbox Full-trust and Client-Side Solutions DEMO
Load Balancing Partial Trust can be run in two modes • Local Mode • Execute code on WFE • Low administration overhead • Lower scalability • Remote mode • Execute on back-end farm machine • Load balanced distribution of code execution requests • Create custom Load balancers
Solution Monitoring • Farm Administrators • Set absolute limits • Site Administrators • Identify expensive solutions Server Resources: CPU, Memory, SQL, Exceptions, Critical Errors, Handles, Threads, …
Resource Quotas Central Admin Solution Gallery Measured in ‘Resource Points’
Administration DEMO
Summary • Sandboxed Solutions greatly improve farm stability • The Sandbox is a separate process where our applications run • The Sandbox has OM and CAS restrictions • Many solution types are supported • Full-Trust Proxies and client-side solutions allow access to resources • Developers create, Site Collection admins install, Farm admins manage
Play the Microsoft Office & SharePoint Track Tag Contest Download the Microsoft Tag Reader Open the internet browser on your mobile phone and visit http://gettag.mobi Grand Prize (1) Xbox 360 Prize Package and Microsoft® Office 2010 Daily Prizes 40 copies of Microsoft® Office 2010 Come to the Expo Hall – Yellow Section OSP Info Desk for Official Rules & Collect Additional Tags from all OSP Track Sessions, Speakers and Expo Hall!
Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • For More Information – http://sharepoint.microsoft.com • SharePoint Developer Center – http://msdn.microsoft.com/sharepoint • SharePoint Tech Center – http://technet.microsoft.com/sharepoint • Official SharePoint Team Blog – http://blogs.msdn.com/sharepoint
Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • Breakout Sessions – See Conference Guide for full list of OSP Track Sessions • Interactive Sessions – OSP Track has 10 Interactive Sessions – OSP01-INT – OSP10-INT • Hands-on Labs – OSP01-HOL – OSP20-HOL • Product Demo Stations – Yellow Section, OSP • Office 2010, SharePoint 2010, Project Server 2010, Visio 2010 have kiosks and demos
Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn
Required Slide Complete an evaluation on CommNet and enter to win!
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.