繁体   English   中英

从控制台C#连接Intranet(OnPremise)SharePoint Server 2013

[英]Connect Intranet(OnPremise) SharePoint Server 2013 from Console C#

我已尝试按照以下文章https://sharepoint.stackexchange.com/questions/205515/first-time-connecting-to-sharepoint-server-2013-from-console/中所述从控制台实施本地SharePoint连接。 205529?newreg = 95ed260c717c4d9fb5fe4856a2daf71a

但问题是,执行程序时会引发内部异常(代码:500)。 无法连接服务器:-(

请检查以下代码,让我知道我在哪里/做错了什么。

using (var clientContext = new ClientContext("http://customersupport/"))
        {
            try
            {
                Console.WriteLine("connecting on-premise sharepoint....");

                clientContext.Credentials = new NetworkCredential(@"domain\username", "password");

                // Get the SharePoint web  
                Web web = clientContext.Web;

                // Load the Web properties  
                clientContext.Load(web);

                // Execute the query to the server.  
                clientContext.ExecuteQuery();

                Console.WriteLine("Conneciton done successfully");

            }
            catch (Exception exe)
            {
                //throws internal exception
                Console.WriteLine(exe.Message);
            }
        }

以下是完整的错误消息:

System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
   at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
   at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at ConnectSharepoint.SharePointOnPremise.Main(String[] args) in C:\Kishor\ac\2018\Test\ConnectSharepoint\SharePointOnPremise.cs:line 34

提前致谢!

检查以下内容:

1.检查所有应用程序池,并检查“ SharePoint Web服务根目录”是否已停止。

在此处输入图片说明

2.检查这些SharePoint Services。

在此处输入图片说明

3.检查IIS Admin Service。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM