When trying to access SharePoint WSS 3.0 server using the web services API, the software service we are developing will hang anywhere between 30-60 seconds when making any call (pick anyone of them, it doesn't matter) against the server for the first time. After this first call is made , each request thereafter is very quick.
This happens on both the local dev install of SharePoint, or against the production SharePoint environment, same results no matter what we try.
When accessing the SharePoint site (both local dev and production) via a web browser, using the same log in credentials as being used with the WSS API, there is zero lag time during the authentication process. But as soon as we try to access the list via VS 2010 it hangs for 30-60 on initial contact, then as stated it is smoking fast thereafter.
It seems to be an authentication issues, but for the life of me I cannot figure it out.
This is the code being used via C# to authenticate to SharePoint WSS:
_lists = new Lists
{
Credentials = new NetworkCredential(UserName, Password, Domain),
Url = string.Format("{0}/_vti_bin/Lists.asmx", BaseUrl),
UseDefaultCredentials = false
}; // Reference the list object.
Once the code hits the line below it hangs for 30-60 seconds.
the GetList(string listName)
_lists.GetList("TestList");
Any call thereafter is extremely fast.
One last note. When trying to access the service via Visual Studio, we receive the popup dialog to enter credentials, Discovery Credentials, and it will not authenticate, but we are able to retrieve the list of services. This occurs on both the production and test environments.
Please see images in order of events for adding a web service:
Next we get three dialog for list, error and meta data and none of them validate.
Close Up for First screen:
We finally hit cancel.
And can see the calls we can make against the service:
I have even tried the look back hack and no dice.
Update: After reviewing the recommendation here I tried them each and I even ended up caching the credentials as this:
_lists = new Lists
{
Url = string.Format("{0}/_vti_bin/Lists.asmx?WDSL", BaseUrl),
UseDefaultCredentials = false
}; // Reference the list object.
//Create an instance of the CredentialCache class.
CredentialCache cache = new CredentialCache();
// Add a NetworkCredential instance to CredentialCache.
// Negotiate for NTLM or Kerberos authentication.
cache.Add(new Uri(_lists.Url),"Basic", new NetworkCredential(UserName, Password, Domain));
_lists.Proxy = null;
_lists.Credentials = cache; // new NetworkCredential(UserName, Password, Domain); //cache;
Yet, the call is made to get the Sharepoint List Data and the lag time is still 30-60 seconds, and then each call thereafter on the same connection is fast via the WSS.
But, if I restart the command line app within a few seconds retrieving the list is almost instant, but it I wait wait 5 minutes, then the 30-60 second lag time again. This is really frustrating and I am at a loss.
Anyone have any more ideas?