How to: Debugging SharePoint 2010 SandBoxed applications created in VS2010

SandBox.jpg

Microsoft Visual Studio 2010 offers a very handy way to develop code (eg. a web part) for SharePoint 2010 in two flavours. You can either develop an application that will have full access to SharePoint features and resources (and which will require a SharePoint Administrator to install) or you can develop a SandBoxed solution that will not have the same access level but which can be installed by site collection owners without administrator rights. For more information on Sandboxed Solutions make the jump to the introduction post.

Unfortunately, although opting to code in a sandbox is as straight forward as selecting one of the two options as displayed in the photo above, debugging and deployment are not just as easy. That is because, most of us have to deal with the following error message:

Error 1 Error occurred in deployment step ‘Activate Features’: Timeout occurred while running the SharePoint Sandboxed Code service. This service is required to run sandboxed solutions in SharePoint. Please ensure the service is configured correctly in SharePoint.

What’s even worse is that although the error message does point to a service that needs to be activated, it is not very helpful as the specific service may differ from configuration to configuration.

In my case, the service that was not running was the SharePoint 2010 Administration. Note that this is not a feature that needs to be activated in SharePoint though the SharePoint Central Administration. It is rather a Windows Server service that needs to be activated on the local server!

Other services that you may have to manually start (or set the Start Up Type to automatic) are the: 1. SharePoint 2010 User Code Host and 2. Microsoft SharePoint Foundation User Code Service (thanks to Corey at DotNefMafia for the last one – this service is not even available on my configuration).

As soon as you activate these services on your machine, you can go back to casually debugging your application in Visual Studio, which will start your default browser in order to test your SandBoxed application as soon as you tap on F5.

Note that if you were creating a web part, you will need to click on site actions, then edit the SharePoint page, then select the second tab on the top (the one saying “Insert”) and finally, add your custom web part from the custom web parts list. In order to save the page, you have to click on the “Format Text” tab ( the one next to the one you clicked earlier) and then click on Save. It’s kinda lame that you can’t save staright from the other tab but what can you do?

Hope that helps 🙂

Powered by Zoundry Raven

Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

Powered by Zoundry Raven

MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

One thought on “How to: Debugging SharePoint 2010 SandBoxed applications created in VS2010

  1. Phillip

    Thanks, couldn’t figure out the issue and your solution worked for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.