I have developed silverlight web part for sharepoint 2010. I have developed nearly 5 web part in sharepoint 2010. All the web parts was working fine upto last night on development machine as well as on server. Now today I started my computer. I have tried to run my web part in vs 2010. I was not working. It is giving error as e.Message - The remote server returned an error: NotFound.
and e.StackTrace - at
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)
The following is my code
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);
});
}
In the above code breakpoints in method handleAllCompaniesRequestFailed
gets hit. It executes all statement within GetAllCompanies
. I checked that the the development machine is able to access the local sharepoint site in browser. Can you please tell me why this web part is not working today ? Can you please provide me any code or link through which I can resolve the above issue ?