我为 Sharepoint 2007 Farm 创建了一个预热脚本,我在 ArrayLists 中获取了 webapps、sitecollections、网站、网站和子网站的所有 URL。之后,我使用以下代码从每个网络获取响应,但是它花费了太多时间,我想知道是否有任何替代或更好的方法来做到这一点,并且它会花费更少的时间/资源。
WebRequest request = WebRequest.Create(URL);
request.Proxy = null;
if ((userName == null) || (userName == ""))
{
request.Credentials = CredentialCache.DefaultCredentials;
}
else
{
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(URL), authType, new NetworkCredential(userName, password, domain));
request.Credentials = myCache;
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(response.StatusDescription);
using (Stream dataStream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(dataStream))
{
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
}
我在谷歌上试过,但找不到太多相关的,或者我不知道如何使它与此相关,
干杯