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

  • SEARCH
  • Home
  • 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 7632967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:45:40+00:00 2026-05-31T06:45:40+00:00

I have written some data fetch service which fetches some entities from main web

  • 0

I have written some data fetch service which fetches some entities from main web server, web server delivers the items and client processes the items.

Web Method

[OperationContract]
public DataItem[] GetPendingItems(){
    using(DBContext c = new DBContext()){
        var q = c.DataItems.Where(x=>x.Attempts<4)
                 .OrderBy(x=>x.Attempts)
                 .ThenBy(x=>x.ItemID);
        foreach(var item in q){
           item.Attempt ++; // making sure item was sent from server
           // log what was sent..
        }
        Utils.Log(DateTime.Now, items);
        c.SaveChanges();
        return q.ToArray();
    }
}

Now similar code on client side has been written in such way..

while(true){
    var items = wcfClient.GetPendingItems();
    Utils.Log(DateTime.Now, items);
    // do something with items..
}

Now here is the problem,

Sent by Server

10:10:10 1,2,3
10:10:11 4,5,6
10:10:11 7,8,9

Received by Client

10:10:10 1,2,3
10:10:11 4,5,6
10:10:11 4,5,6 <-- this is the problem

wcfClient is a global WCF Service Instance
Now I know this could be the issue, so we are trying to create new WCFClient instance and trying to see if it works, but if you notice, in my while loop, the calls are completely independent and synchronous.

But looking more closely, this happens rarely, but looks like WCF client returns and old response back to us instead of what it did fetch from server.

Now is there any settings that can explain me why this happens, or why does WCF cache response at all.

We are using latest .NET 4.0 framework on both ends. On an average 2-5% items are missed this way.

I do not have good experience in WCF, but knowing nature of WCF, it should not cache anything at all. Even if it is sending cached response, WCF should not execute method on server.

I assume all are HTTP POST requests as we have chosen BasicHttpBinding.

UPDATE

Changing client code to following resolves the issue,

while(true){
    var wcfClient = new WCFClient();
    var items = wcfClient.GetPendingItems();
    Utils.Log(DateTime.Now, items);
    // do something with items..
}

So why does this occur if same client is used?

  • 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-05-31T06:45:41+00:00Added an answer on May 31, 2026 at 6:45 am

    Changing code to following resolves the issue,

    while(true){
        var wcfClient = new WCFClient();
        var items = wcfClient.GetPendingItems();
        Utils.Log(DateTime.Now, items);
        // do something with items..
    }
    

    Reusing WCFClient (Soap Client Endpoint) causes it to send cached data, even when it should not.

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

Sidebar

Related Questions

I have written some thing like this to fetch data from the database. public
I have written a web service that returns some data as json. To display
I have written a Perl CGI script which fetches an html page from a
I have written some code using jQuery to use Ajax to get data from
I have written some code to fetch zipcodes from a mysql db via ajax
I have written a small web app to collect some data and store it
I have a web service which requires me to send file data to HTTP
I have written some code to ensure that items on an order are all
I have written a Perl script that reads some data and generates an OpenOffice
I have a class called Object which stores some data. I would like to

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.