I have a SharePoint 2013 development environment I am using for multiple site collection in my web farm. Each site collection is associated with a Fully Qualified Domain Name (FQDN). I am developing a separate custom farm solution for each of these site collections and want to be able to debug against each of these site collections.
When I create my SharePoint 2013 project in Visual Studio, it asks me to specify the SharePoint site to connect to and typically defaults to the name of the web server. When I enter the actual FQDN, i.e. dev1.catapultsystems.com, I get the following error message:
Cannot connect to the targeted site
Even though the SharePoint site collection is hosted on the local system, because I am using a Fully Qualified Domain Name of dev1.catapultsystems.com, it is fooled into thinking that I am attempting remote development, which is only supported for Apps for SharePoint 2013.
This is a known bug that should be fixed in upcoming developer tool releases for Visual Studio, but there is a workaround. (For development environments only!!!)
*** Use your host file to set the FQDN to the physical IP address of the development server. ***
To do this, follow these steps:
- Open your Host file in Notepad (you may need to run Notepad as an administrator). The Host file is located at c:\Windows\system32\drivers\etc\hosts.
- Add an entry to the host file to set the site collection web site to the physical IP address of the development server
Visual Studio was able to connect immediately, no reboot required!