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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:35:51+00:00 2026-06-04T17:35:51+00:00

I need to create a WCF Service that will have a download file function.

  • 0

I need to create a WCF Service that will have a download file function. This WCF will be consumed by a Delphi application.

The problem: The files that will be downloaded are very large and may cause memory problems on Delphi side. So far, I have this code:

[OperationContract]
byte[] DownloadFile(string filePath);

But this code will cause the client app to hold all data in memory which can be an issue.

I have read that WCF is capable of streaming data as you can read at: How to: Enable Streaming

But I have a question regarding this piece of code cut from MSDN:

[OperationContract]
Stream GetStream(string data);

On the client side I want to pass a TFileStream to the function. By using TFileStream every byte read will go directly to the disk. But the function RETURNS a stream and what I want will not be possible since the stream will not a parameter to the function.

How can I download a file from a WCF service directly to the disk?

  • 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-04T17:35:52+00:00Added an answer on June 4, 2026 at 5:35 pm

    I have found that relying on “built-in” streaming capability in WCF when working with other (non-.NET) clients is a big source for strange problems…

    Basically we solve this kind of scenario by defining:

    [OperationContract]
    string DownloadFile(string filePath);
    

    The method generates a HTTP(S) url and returns it…

    This way any http-capable client can work with the data in a robust fashion…

    BEWARE that this makes the server a bit more complicated since you now need to have some mechanism to generate (and serve HTTP GET on) URLs (security, “globally” unique, only usable for a limited time etc.).

    BUT the big advantage is that any client out there (mobile or some strange embedded device or whatever you might encounter) will be able to implement this scheme as long as it has http-support available (Delphi has some very good http-client options).

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

Sidebar

Related Questions

I have to create a WCF service that will accept thousands of requests every
I have a web service that will be consumed by some application (web site
I need to create a service which will maintain a WCF session. In the
I am at a stage of building a wcf service for my application that
Hi, I have a WCF(TCP/IIS7) application that needs to add performance counters on startup,
I have a WCF Service that exposes a method GetCustomers(). The internals of the
I have a wcf service that takes in an IRepository IRepository irepo; public SomeService(IRepository
I need to implement a project that will consume XML Web Service from other
I have to create a simple app, that will suit as an example of
I have a WCF service which will be hosted under IIS. Now I have

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.