Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:19:37+00:00 2026-06-17T19:19:37+00:00

I have a problem consuming an OData-service in a Windows 8 store application. If

  • 0

I have a problem consuming an OData-service in a Windows 8 store application.

If I do this:

IEnumerable<vw_mobSurveyor> lstSurveyors =
    await ((DataServiceQuery<vw_mobSurveyor>)ODataContext.vw_mobSurveyor
        .AddQueryOption("$filter", "intSurveyorID eq " + intID.ToString()))
        .ExecuteAsync("GetByID").ConfigureAwait(false);

it works and the end of the URI is: /vw_mobSurveyor?$filter=intSurveyorID eq 1. This URI also works if I try it in a browser, so all is well.

But if I do :

IEnumerable<vw_mobSurveyor> lstSurveyors = 
    await ((DataServiceQuery<vw_mobSurveyor>)ODataContext.vw_mobSurveyor
        .Where(s => s.intSurveyorID == intID))
        .ExecuteAsync("GetByID").ConfigureAwait(false);

This fails with a Client Internal Error 4. It produces a different ending to the URI: /vw_mobSurveyor(2) This URI fails when I try it in a browser, and that is why it fails when the code generates it.

I have read these two should be equivalent in the produced URI: http://msdn.microsoft.com/en-us/library/ee622463.aspx#filtering.

As I would like to pass a Linq expression in future, so I need to get the second version to work. So how do I force the second version to use $filter so it works?

Update : Fiddler output for working code using $filter

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 1057
Content-Type: application/atom+xml;type=feed;charset=utf-8
Server: Microsoft-IIS/7.0
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 18 Jan 2013 11:35:34 GMT

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http://MYSERVER/TESTAPP%20V1/DataService.svc/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <id>http://MYSERVER/TESTAPP%20V1/DataService.svc/vw_mobSurveyor</id>
  <title type="text">vw_mobSurveyor</title>
  <updated>2013-01-18T11:35:34Z</updated>
  <link rel="self" title="vw_mobSurveyor" href="vw_mobSurveyor" />
  <entry>
    <id>http://MYSERVER/TESTAPP%20V1/DataService.svc/vw_mobSurveyor(2)</id>
    <category term="SurveyProModel.vw_mobSurveyor" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" title="vw_mobSurveyor" href="vw_mobSurveyor(2)" />
    <title />
    <updated>2013-01-18T11:35:34Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:intSurveyorID m:type="Edm.Int32">2</d:intSurveyorID>
        <d:vchName>Bob Green 2</d:vchName>
        <d:vchStatus>Surveyor</d:vchStatus>
      </m:properties>
    </content>
  </entry>
</feed>

Update : Fiddler output for failing code

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 824
Content-Type: application/atom+xml;type=entry;charset=utf-8
Server: Microsoft-IIS/7.0
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 18 Jan 2013 11:33:30 GMT

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://MYSERVER/TESTAPP%20V1/DataService.svc/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <id>http://MYSERVER/TESTAPP%20V1/DataService.svc/vw_mobSurveyor(2)</id>
  <category term="SurveyProModel.vw_mobSurveyor" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link rel="edit" title="vw_mobSurveyor" href="vw_mobSurveyor(2)" />
  <title />
  <updated>2013-01-18T11:33:30Z</updated>
  <author>
    <name />
  </author>
  <content type="application/xml">
    <m:properties>
      <d:intSurveyorID m:type="Edm.Int32">2</d:intSurveyorID>
      <d:vchName>Bob Green 2</d:vchName>
      <d:vchStatus>Surveyor</d:vchStatus>
    </m:properties>
  </content>
</entry>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:19:39+00:00Added an answer on June 17, 2026 at 7:19 pm

    This seems like a bug in the WCF Data Services client.

    At first glance, I don’t see any issues in the Fiddler traces you provided, but I’ll try to reproduce this on my end and I’ll file an internal bug for this. If you have a full stack trace of the error, that would be very helpful.

    Just to note: the LINQ-to-URI translation bit is doing the correct thing here. If a .Where clause is only checking the key value of an entity, we optimize the query by directly looking up the entity by its key (i.e., ../vw_mobSurveyor(2)) instead of using the $filter mechanism. This will result in an entry response payload instead of a feed, which matches what you got from Fiddler.

    And to answer your original question, you could force the LINQ translator to use $filter by making the predicate involve anything other than the just the entity key. For example, you could do something like:

    .Where(s => s.intSurveyorID == intID && true)
    

    This is obviously a hack, but it should work. Ideally, we’ll find and fix this bug and you can then use a more normal-looking Where clause :).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem consuming a WCF REST service in my android application. The client
I have a problem with consuming a third-party web service in .NET C#. It
I have a Silverlight 2 application that is consuming a WCF service. As such,
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with show or hide form in Window Form Application. I start
I have a problem that has been consuming me for days. I have a
I am new to ADO.net and have this problem: Let's assume I have these
This is a problem I've encountered on both Windows and Mac for many, many
EDIT: This problem is unbelievable. I have now managed to replace an annoying print
I have problem with consuming DbContext class in EF 4.3 CodeFirst approach. As for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.