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.

I have created a sandbox solution using Visual Studio 2010. When i tried to deploy the solution from Visual Studio 2010 (right click the solution and click on Deploy Solution), i was getting the following error.

"Error occurred in deployment step 'Retract Solution': 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."

The reason is in the services.msc "SharePoint 2010 User Code host" service status was not started.

Go to Run, enter services.msc and then click on Enter.

Right click on "SharePoint 2010 User Code host" service  and then click on Start.