I am using an ASP.Net app to connect to SharePoint 2019 using CSOM library. What i discovered is that every morning when i run my app i get the above error and when i switch to the SharePoint server and i just open the site am trying to connect to and switch back to run my asp.net app it works.
I don't understand why each morning i need to visit the SharePoint site for this to work. Can you guys explain what is happening here?
using (var clientContext = new ClientContext("http://sharepoint.domain.local/sites/test/"))
{
var cred = new NetworkCredential("testuser", "password", "domain");
clientContext.Credentials = cred;
// Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> stream = null;
var keywordQuery = new KeywordQuery(clientContext);
keywordQuery.QueryText = SearchParameter;
// keywordQuery.EnablePhonetic = true;
keywordQuery.EnableOrderingHitHighlightedProperty = true;
//keywordQuery.SummaryLength = 500;
var searchExecutor = new SearchExecutor(clientContext);
var results = searchExecutor.ExecuteQuery(keywordQuery);
clientContext.ExecuteQuery();