Issues with Visual Studio 2012 Connecting to the SharePoint Sites with Host Headers – Cannot connect to the targeted site

I came across very peculiar issue when I was trying to create SharePoint 2013 Project in Visual Studio 2012 while connecting to my SSL enabled SharePoint Sites. Visual Studio thrown an error – cannot connect to the targeted site. This error can occur if the specified site is not hosted on the local system.

Visual Studio SSL URL Error

Since I am working on all-up VM with AD, DC, DNS, CA, SQL, SharePoint, Office, SPD, and Visual Studio all runs on same machine, obviously issue was with the method of how Visual Studio trying to connect to the SharePoint. As you can see in the DNS entries below, https://intranet.niks.local (the site I am trying to specify as debug site in Visual Studio) pointing to the correct IP ( mapped to the local host.

DNS Configuration

After doing some quick research on google, apparently it seems like this issue was introduced in Visual Studio 2012 RC and how VS connects to the SharePoint using host file entries (not DNS entries) to recognize host header enabled SharePoint sites. As soon as I read Waldek‘s article, I knew where was the problem.

I was able to connect to the my Non-SSL SharePoint sites from Visual Studio 2012 up until last week. I was using hosts files to route all the URL requests to the host header enabled Non-SSL SharePoint sites. After configuring SSL this week on my local SharePoint environment, I have cleaned up all the host file entries to ensure all the URL routes through DNS.

Since Visual Studio uses hosts files to connect to the SharePoint sites, it would make sense why it was working for Non-SSL sites (with host file entries) and why it wasn’t working with SSL sites (without host file entries). As soon as I have updated host files to route SharePoint host header enabled sites, Visual Studio was able to connect to the SharePoint site while creating new projects.

Host File Changes

Visual Studio SSL URL Sucecss

Thanks to thousands of references out there in Google, I was able to quickly save some time for me.

Additional Resources

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Issues with Visual Studio 2012 Connecting to the SharePoint Sites with Host Headers – Cannot connect to the targeted site

  1. I tried to use the steps provided by you; but i am still facing same issue. I am using SharePoint 2013 which is installed on VM server where SQL is also installed. I want to access site which was created on VM server from my deloper machine. My developer machine has installed sharepoint 2013 foundation. Can you please help me.

    • Nik Patel says:

      Hi Minakshi, Have you able to fix the issue. Sorry about responding later. It seems like you have multi-server development machine. SharePoint 2013 doesn’t support remote development except Apps. You must have single server VM with SharePoint and Visual Studio.. You can have SQL and AD on dedicated machine but VIsual Studio must be installed on single server SharePoint farm. Hope that helps….

    • Nik Patel says:

      Reading again your comments, it seems like you are using developer machine with SharePoint 2013 foundation installed.. That should work…

Leave a Reply to Nik Patel Cancel reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s