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 7432255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:25:46+00:00 2026-05-29T09:25:46+00:00

I have a control that uploads 1..n files in chunks to a WCF service

  • 0

I have a control that uploads 1..n files in chunks to a WCF service of mine. The chunking and reassembling is done via multiple calls to the WCF service which all works well for 1 file.

However when I have more than 1 file I am running into some issues. The outer loop which contains the data for each file continues on prior to the 1st file finishing uploading. In fact if it takes 10 calls to chunck a file to the server via WCF calls, processing returns after the 1st call to WCF because it is async with no blocking. This entire process is initiated by an Upload button click, so I assume this is being done on the UI thread. I have tried using an ‘AutoResetEvent’ but to no avail; it always freezes.

What I need is the outer loop to halt processing until the 1..n async calls to WCF within (via ProcessFile method) are completed and an entire single file has been uploaded. Code below:

'FileUploadData is an Observable collection of IO.FileInfo objects
For Each FileItem In FileUploadData
   'Method internally calls WCF asynchronously and does so continually until file is completely uploaded.
   ProcessFile(FileItem)
   'NEED TO STOP HERE until file passed in above is complete.
   'Currently processing continues on because 1st call to WCF is async and processing is returned to here.
Next

I am not necessarily looking for a syncronous solution here, but I need some method to allow these files to either be uploaded on their own thread or upload completely in the ‘ProcessFile’ method 1st (still calling WCF async) before continuing the outer loop to the next file displayed above.

Any ideas on how to solve this? Thanks!

  • 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-29T09:25:46+00:00Added an answer on May 29, 2026 at 9:25 am

    Ok got this figured out almost as quick as posting this question (great when that happens). This article (http://www.informit.com/articles/article.aspx?p=1759240) helped me think of a slightly different way to appraoch this with a basic method I was already using.

    I now use a LINQ query to only process 1 file at a time from the collection instead of a loop to continually process all of them. Once the file has completed loading I remove it from the collection, and I raise an Event I declared at the end of the ProcessFile method. The Event handler method is raised and selects the next file to process in the collection and repeats this until complete.

    Dim NextUpload = (From f In FileUploadData
                     Select f).FirstOrDefault
    
    If NextUpload IsNot Nothing Then
       ProcessFile(NextUpload)
    End If
    

    Works like a charm!

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

Sidebar

Related Questions

i have this file upload control which uploads all kinds o f files. i
I have a .NET webform that has a file upload control that is tied
I have a control that, upon postback, saves form results back to the database.
I have a control that is created like so: public partial class MYControl :
I have a control that is basically functioning as a client-side timer countdown control.
I have a control that I'm writing where I want to turn off .NET's
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
I have a control that has a Filter property that expects a function that
I have a control that goes inactive under some conditions in my iPhone app.
I have a control that has a byte array in it. Every now and

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.