C# 无法从 Visual Studio 2010 连接到 Sharepoint 站点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9785917/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot connect to the Sharepoint Site from Visual Studio 2010
提问by Amin Sayed
I'm new to Sharepoint. I'm trying to create a simple webpart using Visual Studio 2010 but when I try to validate my Sharepoint Server (both VS 2010 and Sharepoint are present in the same system) it says:
我是 Sharepoint 的新手。我正在尝试使用 Visual Studio 2010 创建一个简单的 webpart,但是当我尝试验证我的 Sharepoint 服务器(VS 2010 和 Sharepoint 都存在于同一系统中)时,它说:
Cannot connect to the SharePoint site: http://wpnne76648:2010. Make sure that the Site URL is valid, that the SharePoint site is running on the local computer, and that the current user as the necessary permissions to access the site.
无法连接到 SharePoint 站点:http://wpnne76648:2010。确保站点 URL 有效,SharePoint 站点在本地计算机上运行,并且当前用户具有访问站点的必要权限。
If I ignore this and click finish and then try to deploy the application it says:
如果我忽略这一点并单击完成,然后尝试部署应用程序,它会显示:
Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.
部署步骤“回收 IIS 应用程序池”中发生错误:本地 SharePoint 服务器不可用。检查服务器是否正在运行并连接到 SharePoint 场。
Note: I can open my web application in the browser.
注意:我可以在浏览器中打开我的 Web 应用程序。
采纳答案by Niranjan Singh
回答by KoenVosters
Have you tried to create a new site collection and connecting to that one? Take into account that merely creating the web application isnt enough, the site collection needs to be there as well.
您是否尝试过创建一个新的网站集并连接到该网站集?考虑到仅仅创建 Web 应用程序是不够的,网站集也需要存在。
回答by MuhammadHani
I've tried the below steps and it solved my issue. using Sharepoint Power Shellto grant my user the privileges to Content Databases.
我已经尝试了以下步骤,它解决了我的问题。使用Sharepoint Power Shell授予我的用户的特权Content Databases。
Add-SPShellAdmin -UserName domain\usernameThis will add permissions to the config database in SharePoint 2010
Add-SPShellAdmin -UserName domain\username这将在 SharePoint 2010 中添加对配置数据库的权限
Get-SPContentDatabase -WebApplicationThis will return information on the content database for the desired web application
Get-SPContentDatabase -WebApplication这将返回有关所需 Web 应用程序的内容数据库的信息
Add-SPShellAdmin -UserName domain\username -databaseThis will add permissions to the content database for the desired web application
Add-SPShellAdmin -UserName domain\username -database这将为所需的 Web 应用程序添加对内容数据库的权限
UPDATE
更新
I've also found that SQL Server Agent(SHAREPOINT)Service was disables, enabling it solved my issue one more time.
我还发现SQL Server Agent(SHAREPOINT)Service 被禁用,使它再次解决了我的问题。
回答by Juan Maya
$db = Get-SPContentDatabase -WebApplication http://mycompany.corp/
Add-SPShellAdmin -UserName domainName\username -database $db.Id
回答by Commander SharePoint
OK, if you have a local SharePoint Farm, you may have to create an AAM pointing to the default URL.
好的,如果您有本地 SharePoint 场,您可能需要创建一个指向默认 URL 的 AAM。
For example, I created a Web App: http://portaldev10.jedi.localbut VS defaulted to http://DEV2010and nothing I could do could get it to resolve the DNS URL... so I created an Internal AAM and VS works.
例如,我创建了一个 Web 应用程序:http://portaldev10.jedi.local但 VS 默认为http://DEV2010并且我无能为力让它解析 DNS URL...所以我创建了一个内部 AAM 和VS 有效。
Crazy... I know
疯了……我知道
回答by Motuma Kaba
Probably this step will help you.
可能这一步会对你有所帮助。
I tried all the possible solutions with Active Directory, IIS Authentication and finally was able to fix the issue just by doing the below. Hope this will help you in similar kind of issue.
我使用 Active Directory、IIS 身份验证尝试了所有可能的解决方案,最后仅通过执行以下操作就能够解决该问题。希望这能帮助您解决类似的问题。
1.Do a IIS reset
1.做一个IIS重置
2.Check if IIS is resetting.
2.检查IIS是否正在重置。
3.If it is not, then disable UAC from control panel and IIS reset will work.
3.如果不是,则从控制面板禁用UAC,IIS重置将起作用。
4.Go to Central Administration site
4.转到管理中心站点
5.Navigate to the Manage Web Applications page
5.导航到管理 Web 应用程序页面
6.Click on the web application that hosts the site you are trying to deploy
6. 单击托管您要部署的站点的 Web 应用程序
7.Click the User Policy ribbon item.
7. 单击用户策略功能区项。
8.Add your windows account to the list of users with the Full Control permission.
8.将您的 Windows 帐户添加到具有完全控制权限的用户列表中。
Good Luck
祝你好运

