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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:35:02+00:00 2026-06-09T12:35:02+00:00

I have a streamed WCF service. In one operation, I receive a file, for

  • 0

I have a streamed WCF service. In one operation, I receive a file, for upload purposes.
If I try to do something like this

request.FileContent.Length

Then I receive an OperationNotSupported exception. That’s Ok.
But how could I get the file size without actually transfering it entirely?
I know I could send this information along with the call, as a Header, but I don’t want to go this way.

If WCF is able to limit the request size trough maxReceiveMessageSize. How can I use the same information to check the message/stream size?

  • 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-09T12:35:03+00:00Added an answer on June 9, 2026 at 12:35 pm

    In general, you can’t know the size of a byte stream without reading it all and counting the bytes, unless there is data at the start of the stream which tells you how many bytes there are in the entire stream, or some other out-of-band way to communicate the length of the stream, such as in the WCF message headers. You will have to go with the Header approach if you want to know the size without reading the stream.

    The WCF maxReceiveMessageSize works by counting the bytes as they are received and throwing an exception if the limit is exceeded… it doesn’t know the stream length either, and can’t pre-emptively prevent the message being received without first reading the maximum allowed number of bytes.

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

Sidebar

Related Questions

I have a WCF file upload service, which is using streamed mode. Is it
I have a WCF-REST service with one method which returns a string: [ServiceContract] public
I have WCF service library with this config: <basicHttpBinding> <binding name=httpLargeMessageStream maxReceivedMessageSize=2147483647 messageEncoding=Mtom transferMode=Streamed
I have wcf service. I tried to generate proxy code and configuration file for
I have a WCF service which has one method returning a stream. [ServiceContract] public
I have a WCF Service exposing a single contract and operation: <ServiceContract(Namespace:=ImageSystem)> _ Public
I have a WCF service that can return a stream via a WebGet. This
I am trying to get streamed output from a WCF service. I have set
I have problem with streaming. When I send small file like 1kb txt everything
I have a WCF service deployed to IIS 7 and the client. I thought

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.