SharePoint 2010의 Lists.asmx (양식 인증)를 사용하여 listitem 데이터를 가져옵니다.SharePoint 2010에서 Lists.asmx를 사용할 때 CommunicationException을 처리하는 방법
코드는 다음과 같습니다.
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.CompleteGetResponse System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.ProcessResponse (HttpWebResponse 클래스 응답 WebException이 responseException) (IAsyncResult를 결과) System.ServiceModel.Channels에서 에서 . HttpChannelFactory.HttpRequestChannel .HttpChannelAsyncRequest.OnGetResponse (IAsyncResult result) at System.Net.Browser.ClientHttpWebRequest.나는 심지어 CommunicationException을 처리 할 수 <> C_ DisplayClassa.b _8 System.Threading.Timer.ring (에서 System.Threading.ThreadPool.WorkItem.doWork (객체 O) 에서 (개체 상태 2) ) try ~ catch를 사용하면됩니다. 그래서 CommunicationException을 처리하는 방법을 알려주십시오.
감사합니다. –
감사합니다. 그러나 귀하의 조언을 사용하여 해결할 수 없습니다. GetListItemsCompleted가 시작되기 전에 CommunicationException이 발생했습니다. 또한 try ~ catch 블록에서 Exception을 catch 할 수 없습니다. –