When I tried to deploy the solution to a SP Site collection, I received the below error
Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site: http://servername/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.
I restarted the Visual Studio 2012 but still I received this error when deploying the solution.
Then I realized the current user on the web content database was not the owner. I added the current user to the web content database with owner role. This time when I deployed the solution, the error disappeared.
Hope this helps,