Hi there,
There are 2 WFEs in SharePoint Farm: (A) is http://win-cvr30lpg5md:8001/; (B) is http://win-kv6lnvqne00:8001/. the Central Administration of SharePoint lives in the (B) WFE machine.
My question is when I access the (A) and (B) WFEs by CSOM, the result is
(A WFE): I got the following error:
Unhandled Exception: 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.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Core.SPHelper.Start.GetAuthenticatedContext(String siteUrl, String farmAdmin, String password, String domain) in C:\Users\Administrator\source\workspaces\ogcio.pilotsystem\Integration Class\Core.SPHelper\Core.SPHelper\Start.cs:line 75
at Core.Simulator.Program.Main(String[] args) in C:\Users\Administrator\source\workspaces\ogcio.pilotsystem\Integration Class\Core.SPHelper\Core.Simulator\Program.cs:line 94
(B WFE): work well
my source code: Does anyone have any solution for it? Thanks
public static ClientContext GetAuthenticatedContext(string siteUrl, string farmAdmin, string password, string domain)
{
ClientContext clientContext = new ClientContext(siteUrl);
clientContext.Credentials = new NetworkCredential(farmAdmin, password, domain);
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
Uri uri = new Uri(siteUrl);
if (uri.Scheme == "https")
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(customXertificateValidation);
}
clientContext.Load(clientContext.Site.RootWeb);
clientContext.ExecuteQuery();
return clientContext;
}