Remote SharePoint site connections are not supported.

When I do SharePoint development, I usually work with multiple web applications. One for My Site, one for publishing, one for search, etc. I also use host headers to identify each web application so that I don’ t have to remember different port numbers.

On my developer box, I add a number of entries to the hosts file that map each host name to 127.0.0.1. This has worked on all previous versions of SharePoint and Visual Studio, but stopped with the Beta version of the Visual Studio extensions for SharePoint 2013.

When trying to use http://col.sp15.dev as the Site Url

You end up with the following error message:

If I enter http://machinename, everything works as expected.

Why do I get this error message? Everything is running on my local machine. I only have one machine and all host names resolve to the loopback address.
Refusing to accept this limitation, I started exploring the extension code written by Microsoft.

When setting this property, the code makes a lot of checks. One of them is the IsLocalByIp(). The url being passed is the one you type in the property window.

If you copy this code to a console application and run it, it’s easy to discover why things are not working. The hostAddresses variable contains all the addresses of the computer except the 127.0.0.1 address. The second variable contains the 127.0.0.1 address specified in the hosts file. Since this is not considered a local address, the test fails.

Hopefully Microsoft will add an exception rule for 127.0.0.1 in this code. Until then, the solution is to use the IP address of your machine in the hosts file, not 127.0.0.1. If you have a dynamic IP address, remember to update the host file.

Advertisements