How to make WCF Service to return a file?

trowa
trowa used Ask the Experts™
on
How can a WCF Service return a file (perhaps in stream?) based on its file type?

The idea is to let the end user calling the web method and then to get the file downloaded to end user.

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Developer
Commented:
You're already on the correct track: You can only stream data. This is not depended on the file type. Just need a protocol to transmit the complete file name, but this can be already the simple method signature like DownloadFile(string filename), when invoked by the client.

The only caveat: Take a look at the file sizes, cause WCF streaming is per default limited to imho 1M. So you need to dig into the WCF configuration.

- Large Data and Streaming
- How to: Enable Streaming
- File Transfer with WCF

Author

Commented:
Hi,

Is there any existing project sample files I can look into?

I kinda not so understand for the content and guidance provided in those links above.

Thank you.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: ste5an (https:#a42040763)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial