【发布时间】:2011-08-14 17:39:41
【问题描述】:
我在 SharePoint 2010(表单身份验证)中使用 Lists.asmx 获取 listitem 数据。
代码是这样的。
private void GetItems(string listname)
{
ListsService.ListsSoapClient client = new ListsService.ListsSoapClient();
appset = new AppSettings();
client.CookieContainer = appset.CookieSetting;
client.GetListItemsAsync(listname, null, null, null, "10", null, null);
client.GetListItemsCompleted += new EventHandler<ListsService.GetListItemsCompletedEventArgs>(client_GetListItemsCompleted);
}
void client_GetListItemsCompleted(object sender, ListsService.GetListItemsCompletedEventArgs e)
{
listBox1.ItemsSource = from element in e.Result.Descendants(XName.Get("row", "#RowsetSchema"))
select new Lists
{
Title = (string)element.Attribute("ows_LinkTitle")
};
}
当表单认证超时,会抛出未处理的CommunicationException。堆栈跟踪在这里。
在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest 请求,HttpWebResponse 响应,WebException responseException,HttpChannelFactory 工厂) 在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest 请求,HttpWebResponse 响应,HttpChannelFactory 工厂,WebException responseException) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.ProcessResponse(HttpWebResponse 响应,WebException responseException) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult 结果) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult 结果) 在 System.Net.Browser.ClientHttpWebRequest.c_DisplayClassa.b_8(对象状态 2) 在 System.Threading.ThreadPool.WorkItem.doWork(对象 o) 在 System.Threading.Timer.ring()
即使我使用 try~catch,我也无法处理 CommunicationException。 所以,请告诉我如何处理 CommunicationException。
【问题讨论】:
标签: sharepoint sharepoint-2010