我为 sharepoint 2010 开发了 silverlight web 部件。我在 sharepoint 2010 中开发了近 5 个 web 部件。直到昨晚,所有 web 部件在开发机器和服务器上都运行良好。现在我今天启动了我的电脑。我试图在 vs 2010 中运行我的 web 部件。我没有工作。它在 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
. 我检查了开发机器是否能够在浏览器中访问本地共享点站点。你能告诉我为什么这个 web 部件今天不工作吗?您能否提供我可以解决上述问题的任何代码或链接?