8

I'm having a big issue in connecting Visual Studio 2013 to SharePoint 2013. When I create a project in VS2013, I choose SharePoint Empty Project and then the URL of my SharePoint site, when I click on "Validate" I have the error "Cannot connect to the SharePoint site. Make sure that the site URL is valid and that the current user has the necessary permissions to access the site".

I've search all over the internet for a solution to that point but even if I've tried a lot of things, I still have this issue...

In my environment:

  • I am using the SharePoint admin account (used for the installation)
  • I am Site Collection Administrator
  • I have verified / added this account as DBO in 3 differents databases : SharePoint Config / AdminContent and Site Content
  • I am in Local Administrator group of the server
  • I am using Hosts file to identify my Alternate Access Mapping
  • I am using Visual Studio with elevated privilege (Run as administrator) and in the same server where SharePoint is installed
  • Visual Studio 2013 already has Developer Tool included

I've really try a lot of thing, adding another user as DBO in the database, SharePoint site, etc... But I didn't find anything to help me.

Can you help me guys ? Maybe it will be easy for you to identify if I'm doing something wrong

2

first make sure that the account your using to open up vs2013 is the correct account! what you could do is open it up as admin:

To run Visual Studio with administrative permissions on Windows 8, Windows 8.1, Windows Server 2012, or Windows Server 2012 R2

1.On the Start screen, type Visual Studio. You should see the version or versions of Visual Studio you have installed.

2.Select the version of Visual Studio you want to start, and then bring up the shortcut menu (it appears at the bottom of the screen). Choose Run as administrator.

When Visual Studio starts, (Administrator) appears after the product name in the title bar.

To run Visual Studio with administrative permissions on Windows 7 or Windows Server 2008 R2

1.On the Start menu, choose All Programs.

2.In the Microsoft Visual Studio Version folder select Visual Studio Version open the shortcut menu, and then choose Run as administrator.

When Visual Studio starts, (Administrator) appears after the product name in the title bar.

http://msdn.microsoft.com/en-us/library/jj662724.aspx

if that fails which it shouldnt than you can:

Grant the 'sysadmin' server role to the development user account in SQL Server.

Members of the sysadmin fixed server role can perform any activity in the server.

http://msdn.microsoft.com/en-us/library/ms188659.aspx

Guidelines on granting SQL Server sysadmin privileges

http://support.microsoft.com/kb/2184138

the first solution should work as your running under admin account and it would already have sysadmin tied to it..... unless during install somthing happend! If you want to grant a user (different user account) to connect using vs than this method is fine but i wouldnt give sysadmin as its full access and only admin account / farm accounts should have that privlage! if you do than follow this guide!

http://technet.microsoft.com/en-us/library/hh377944.aspx

EDIT

just to make it clear! you cannot connect a normal project from your local machine to a sharepoint server! i think they removed that ability on 2013, also like to note that there is currently only the option of making apps on 2012 remotely that can connect to sharepoint for deployment!

as noted to create projects like webparts and so on you need to develop on a vm either hosted on the server or locally.... that vn has vs2012 that youll develop directly and depoly directly! when you want to run the project on the live server that is where you use the wsp and powershell!

http://msdn.microsoft.com/en-us/library/jj163785(v=office.15)

  • I've tested it with several accounts (admin, farm, new account with manually permissions added [via powershell], etc etc. but none works...) – Jordan Jan 24 '14 at 10:35
  • might sound silly but you are using vs2013 on the server and not remotely? – Ali Jafer Jan 24 '14 at 11:26
  • I'm remotely connecting to the Windows Server with SharePoint / VS installed on it yes! – Jordan Jan 24 '14 at 12:19
  • no it has to be on the server itself! You cant do that! what you can do is use the wsp to deploy to the server but not remotly connect to the server! sharepoint.stackexchange.com/questions/32021/… – Ali Jafer Jan 24 '14 at 13:04
  • I think there is a misunderstanding, I am connecting to my Windows Server 2008 via MSTSC and SharePoint is installed on this server, physically. When I say remotely it was because all servers are virtual ones – Jordan Jan 24 '14 at 14:48
2

Add the account under which Visual Studio process is running to following DBs as dbowner -

  • SharePoint content DB
  • SharePoint central admin content DB
  • SharePoint configuration DB

After that you will be able to both deploy and debug from Visual Studio.

Reference - http://tech-turf.blogspot.com/2015/12/sharepoint-2013-problem-in-debugging.html

1

This worked for me - Grant the 'sysadmin' server role to the development user account in SQL Server

0

I got the same issues as you in the past. And here is my resolution:

  • Add a new user to this server as an administrator.
  • Set this user as a site collection administrator.
  • using remote desktop to this server with the new user. Open VS and can connect to the SP Site(or you can run VS with different user
    by right click + shift on VS application.
  • I've tried that but it doesn't work... But thanks anyway ! – Jordan Jan 24 '14 at 10:33
0

See all the Alternate Access Mappings you have defined for the Web Application and try each at a time in Visual Studio. For some reason the one that works in your browser might not be the one VS is happy with.

0

I didn't come back to you but, unfortunately, an error in the Central Administration wasn't showing : Token Security Service was unavailable, I just restart it on my server and I can finally connect to SP !

Thanks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.