SharePoint Development: Cannot connect to the targeted site


February 5, 2013 - 11:38, by Steven Van de Craen - 7 Comments

Do you have your SharePoint 2013 / Visual Studio 2012 development environment up and running ? If so, you might encounter the following error when you create a new SharePoint Project and enter the URL to your site:

Cannot connect to the targeted site

Cannot connect to the targeted site. This error can occur if the specified site is not hosted on the local system. SharePoint solutions work only with locally-installed versions of SharePoint Foundation or SharePoint Server. Remote development is supported only for apps for SharePoint 2013.

If you – like me – registered the site URL in DNS (local DNS on development machine) then you’ll get this error. It seems that Visual Studio looks at the hosts file (C:\Windows\system32\drivers\etc\hosts) for fully qualified names instead of DNS.

DNS Manager

Once you add the site’s URL to the hosts file (either to 127.0.0.1 or the local IP of the development machine) all is good and Visual Studio will connect just fine.

HOSTS file

Hope this helps!