Regarding SharePoint 2 WFE and CSOM

Will 616 Reputation points
2020-07-18T19:03:48.07+00:00

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;
        }
SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,365 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,619 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,036 Reputation points
    2020-07-20T10:07:53.057+00:00

    Per my test, I could reproduce your issue on my end. In Wfe A, I could acess Wfe A without any issue but could not access Wfe B(same error Internal Server Error 500).

    As a workaround, I use AAM to add a zone for the web application and add a binding in the IIS of the Wfe B.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.