1

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();

2 Answers 2

0

I suspect the app pool has stopped and your request bombs out while the server is warming itself up. Try to have another user access SharePoint before you do, and see if your code behaves afterward.

0

You need to check for when your IIS AppPool recycles and setup warmup scripts to run a few minutes after the recycle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.