Saturday, November 15, 2014

Visual Studio Cannot connect to SharePoint 2013 Site

Cannot connect to SharePoint , Make sure that this is the Valid URL if you happen to see this error in your Visual Studio while deploying the SharePoint application. 

Even if you sure that the URL works fine on your browser then the reason could be as follows,

  1. You are not a  site collection administrator on the site where you trying to deploy.
  2. Your account is not part of the Farm Administrator Group.
  3. Host file might be missing your Alternate Access Mapping URL.
To workaround to this issue.

1 : Add your account to Site Collection Administrator
Site Settings ------> User and Permission-->Site Collection Administrator.
Still if you are facing this issue, probably you don't have permission on the WSS_Content DB in which your site collection data residing.

If you are working your local Server or VM then you are the super user, good to go in to SQL Server and locate the WSS_Content DB add your  account "db_owner" role.

2,Add your account to SharePoint Farm Administrator Group.

In Central Admin Page under "Security" header "Manage the Farm Administrator Group" there add your account and test the deployment activity in visual studio.

Alternatively you can also do power shell script

$ConfigDb = Get-SPDatabase | Where-Object { $_.Name -eq "Sharepoint_Config" }
Add-SPShellAdmin -Username Murugesan\Murugesan -Database $ConfigDb.ID

3,On your Server C:\Windows\System32\drivers\etc\host file
Open this with note pad file add your site Alternate Access Map URL of your site collection
example :    

Additionally if you are working on App Model in SharePoint,I assume already you have configured your SharePoint 2013 for App Development ready,
still if you get this below error :

Error Occurred in deployment step "Install App" for SharePoint : we are sorry weren't  able to complete the operation,Please try again in few minutes.If you are seeing this error repeatedly,contact your administrator.

Then you need to give "SPDataAccess" role on the below database.