0
그래서 내가 전에 호스팅 SharePoint 사이트 작업을하고 있었고, 난 아래의 코드를 사용하여 해당 사이트에 인증 할 때 모든 것이 잘 작동했다 : 이제SharePoint Server의 인증 오류
private static NetworkCredential credentials = new NetworkCredential(username, password, domain);
private static ClientContext clientContext = new ClientContext("https://thisonesite.com/hosting/151");
private static Web site = clientContext.Web;
private static List list = site.Lists.GetByTitle(listName);
private static void sharepointLogin()
{
try
{
//Loads credentials needed for authentication
clientContext.Credentials = credentials;
//Loads the site
clientContext.Load(site);
//Loads the site list
clientContext.Load(list);
//Executes the previous queries on the server
clientContext.ExecuteQuery();
//Writes out the title of the SharePoint site to the console
Console.WriteLine("Title: {0}", site.Title);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
를, 내가 나를 위해 만든 샌드 박스를했고, 사이트에 직접 액세스 할 수 있습니다. 그러나 내 C# 코드를 통해 사이트에 인증하려고하면 오류가 발생합니다.
사용자 이름, 암호 및 도메인 이외에 실제로 변경된 내용은 모두 private static ClientContext clientContext = new ClientContext("http://sandbox");
입니다.
내가 콘솔에서 얻을 오류는 다음과 같습니다
System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at ConsoleApp1.SharePointAccess.sharepointLogin() in C:\directortypath
이 오류가 새 SharePoint 사이트에서 발생하는 왜 갑자기
사람이 알고 있나요?
제목에 "C# -"과 같은 태그를 넣지 마십시오. 이미 [tag : C#] 태그를 가지고 있으며 더 좋습니다. –
@John 죄송합니다. 나중에 참조 할 수 있도록 알려 드리겠습니다. –
나는 실제로 예외를 던지고있는 행을 보려면이 코드를 밟은 것으로 가정합니다. 무엇 이니? 또한 "목록"변수에 대한 정의가 표시되지 않습니다 ... – meccaneko