retrieving data from odata service returns 0 records RRS feed

  • Question

  • Hi There,

    I wrote my first Odata consumer application. The service is running fine. I can retrieve data directly from web ui. But I could not get data through my silverlight application. The code is as follows.

    private void MainPage_Loaded(object sender, RoutedEventArgs e)


    WarehouseModelContainer _context =new WarehouseModelContainer(new Uri("http://serviceuri"));

    DataServiceCollection<Task> _tasks= new DataServiceCollection<Task>();

    _tasks.LoadCompleted += DataLoaded;

    var query = ((from a in _context.Tasks select a).Take(10));



    private void DataLoaded(object sender, LoadCompletedEventArgs e) { //do something }


    Debugging it, I found that in the Dataloaded function, the _tasks has no records.

    What is wrong with my code?


    Wednesday, June 23, 2010 5:22 AM


All replies

  • Hi,

    Could you please try to use some network tracing tool (for example Fiddler) and see what request does the client make and what response it gets back?


    Vitek Karas [MSFT]
    Wednesday, June 23, 2010 11:26 AM
  • Thanks. Yes. This is a cross domain issue. I used Fiddler and found the problem. Following the following link, I solved the problem.


    Friday, June 25, 2010 4:20 AM
  • The request did fail, but with the eveenting API there's no place for the library to throw an exception. So instead we pass the exception on one of the members of the evet args parameter to your event handler.


    Vitek Karas [MSFT]
    Friday, June 25, 2010 6:26 AM