如何删除错误“远程服务器返回错误:NotFound。”?

时间:2012-06-27 10:45:19

标签: c# silverlight-4.0 sharepoint-2010 client-object-model

我为sharepoint 2010开发了silverlight web部件。我在sharepoint 2010中开发了近5个web部件。所有的Web部件在昨晚的开发机器和服务器上工作正常。今天我开始使用电脑了。我试图在vs 2010中运行我的网络部分。我没有工作。它以e.Message - The remote server returned an error: NotFound.和e.StackTrace - 在

给出错误
System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryGetResponseAsyncCallback(IAsyncResult asyncResult)

以下是我的代码

public void GetAllCompanies(ListItemCollectionDelegate populateMethod)
        {
            CompaniesListItemCollectionDelegate = populateMethod;           

            ClientContext clientContext = ClientContext.Current;
            List list = clientContext.Web.Lists.GetByTitle("Companies");

            companiesListItemCollection = list.GetItems(CamlQuery.CreateAllItemsQuery());
            //clientContext.Load(list);
            clientContext.Load(companiesListItemCollection);
            clientContext.ExecuteQueryAsync(handleAllCompaniesRequestSucceeded, handleAllCompaniesRequestFailed);
        }

        private void handleAllCompaniesRequestSucceeded(object sender, ClientRequestSucceededEventArgs e)
        {
            ////call back on the UI thread
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                CompaniesListItemCollectionDelegate(companiesListItemCollection);
            });
        }

        private void handleAllCompaniesRequestFailed(object sender, ClientRequestFailedEventArgs e)
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                MessageBox.Show("GetAllCompanies Method Error : " + e.Exception);
            });
        }

在上面的代码中,方法handleAllCompaniesRequestFailed中的断点被击中。它执行GetAllCompanies内的所有语句。我检查了开发机器是否能够在浏览器中访问本地sharepoint站点。你能否告诉我为什么这个网络部分今天不工作?能否请您提供我可以解决上述问题的任何代码或链接?

0 个答案:

没有答案