locked
Bug in WCF data services update ? RRS feed

  • Question

  • Hi,

    I access my local IIS hosted WCF data service from a windows phone 7 app using the OData client.

    No problem for async loading data from the service.

    Now if I try to update a single entity instance, I consistently get no response from the service if I follow this specific sequence of actions :
    - Launch the wp7 app, which retrieves the list of entries from the Deliveries table
    - In the emulator, select the first item in the list
    - !offending action: open IE and query the service to display the item feed : http://locahost/DelivService/Deliv.svc/Deliveries(5)
    - In emulator, click button to update the item's delivery status and call context.BeginSaveChanges()

    The callback does NOT get invoked for a few minutes, and when it eventually does it throws a "Not Found" exception.

    Breakpoints in the data service on OnStartProcessingRequest and HandleException don't get hit at all.

    Now if I remove the "offending action" above, that is, I don't use the brower to query the service before hitting the update button in emulator, I don't get this issue, breakpoints in the service do get hit, and data does get updated.

    Is this a bug ? if not, how can I debug ? in spite of numerous trials, I couldn't set up fiddler to monitor app traffic in the emulator (only emulator IE is monitored)


    EDIT :
    I've encountered the same issue in the phone app without even having queried the service from the browser first. Seems to occur in a random fashion, sometimes the update goes throughand the callback is invoked, sometimes not.

    Here's the code :

     

    public void Save()

    {

    Context.BeginSaveChanges(
    SaveChangesComplete, Context);

    }

     

     

    private void SaveChangesComplete(IAsyncResult result)

    {

    var ctx = result.AsyncState as  DeliveriesEntities;

    Deployment.Current.Dispatcher.BeginInvoke(() =>

    {

    try
     

    {

    ctx.EndSaveChanges(result);

    }

    catch (Exception ex)

    {

    throw new Exception("Error saving Delivery", ex);

    }

    });

    }

     


    Saturday, March 19, 2011 6:37 PM

All replies

  • Hi,

    Thanks for reporting this issue!

    I have less experience on WP7 and WCF Data Services developing, but I will do some further research on this case and get back to you as soon as possible.

    Good day!

    Thanks


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Monday, March 21, 2011 1:21 PM
    Moderator
  • Hi,

    The issue doesn't seem to occur when I switch to VS dev server, so it looks like its related to IIS hosting.

    Thanks,
    Yacine

    Monday, March 21, 2011 2:50 PM
  • By following the steps in the following blog post, I was able to get Fiddler working for requests made by the WP7 emulator on my machine:

    http://phone7.wordpress.com/2010/10/17/fiddler-and-wp7-emulator-working/

    Without monitoring the HTTP traffic, it's pretty difficult to figure out what is going on.

    Glenn Gailey


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, March 22, 2011 9:11 AM
  • Yes I saw this post a while ago, back when it was posted, however AFAIK this only allows us to view traffic from IE in the emulator, but not traffic from a WP7 app
    Wednesday, March 23, 2011 8:26 PM
  • I following the steps in that post, and now I am using Fiddler to trace a regular WP7 app (not browser) running on the WP7 emulator calling an OData service on a remote server.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, March 24, 2011 8:25 AM
  • Thanks, tried again, you're right I can actually see traffic from my app in the emulator, but only if accessing external services. I haven't found out how to monitor traffic between the emulator and my local IIS
    Thursday, March 24, 2011 8:19 PM
  • Sorry, I haven't actually tried this where the IIS server is hosted by the same machine, so you may be right.

    Make sure that you aren't using localhost in the URI (since Fiddler doesn't do this very well).


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, March 24, 2011 8:34 PM
  • Tried both, localhost and ip, no luck.  Same as described here :
    http://stackoverflow.com/questions/4908612/wp7-emulator-and-fiddler

     

    Friday, March 25, 2011 10:08 AM
  • Hi ykhammal,

    Any luck yet? I think this issue is complicated and i would suggest get in touch with Microsoft and involve the support team and they should be able to help you.

    This needs sample repro code and more investigation.

    Thanks

    Shaikh

    Tuesday, July 12, 2011 9:19 AM
  • A technic that has worked for me in the past when none of the other tricks work is to add a line to my hosts file that redirects an alias to 127.0.0.1 (localhost) and then have my app send request to the alias rather than localhost.

    Add the following line to your hosts file (restart might be required).

    127.0.0.1 foobar

    And then in your service uri in your WP7 app, replace localhost with "foobar". This has usually been enough to get fiddler to pick up the requests.


    Shayne Burgess | Program Manager | OData/WCF Data Services
    Thursday, July 14, 2011 9:19 PM
    Moderator