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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:03:38+00:00 2026-06-15T14:03:38+00:00

I am working on a WCF project that generates and returns a pdf file

  • 0

I am working on a WCF project that generates and returns a pdf file as System.IO.Stream. I have come across a behavior that I cannot explain.

One of the methods exposed by the WCF is as follows:

Public Function Print(ByVal input As Integer) As Stream
    'Do stuff here.
    Return pdfStream
End Function

The client calls the method with:

Dim streamReturn as Stream
streamReturn = Service.Print(input)

This works great. The problem arose when I tried to change the data type of input to String.

Public Function Print(ByVal input As String) As Stream
    'Do stuff here.
    Return pdfStream
End Function

When I updated the Service Reference in the Client, an error is now listed for:

streamReturn = Service.Print(input)

“Value of type ‘1-dimensional array of Byte’ cannot be converted to ‘System.IO.Stream’.”

It appears as though when the data type of my input is changed to String, the transfer mode reverts from streamed back to buffered. Any ideas why?

EDIT: The WCF is in .Net 4.0, the Client is .Net 3.5

  • 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-15T14:03:39+00:00Added an answer on June 15, 2026 at 2:03 pm

    I found a solution. It was due to the serialization method I was using. I had added XMLSerializerFormat() to my ServiceContract so I could use an indexed List inside one of my custom objects. Object was:

    <DataContract()>
    Class MyClass
        <DataMember()>
        Property MyList() As List(Of Object)
        <DataMember()>
        Property MyList(i As Integer) As Object
    End Class
    

    Once I removed the XMLSerializerFormat() tag (Reverting to DataContractFormat) I had to remove the DataMember() tag from the indexed property, then was able to have a String parameter and Stream return.

    <DataContract()>
    Class MyClass
        <DataMember()>
        Property MyList() As List(Of Object)
        '<DataMember()>
        Property MyList(i As Integer) As Object
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project and have come across a problem that so
I am currently working on a project that should be implemented as a WCF
I am working with WCF .NET 3.5 SP1 and have read that one does
I am working on a project that involves an embedded system which runs a
I am working on a Silverlight application that uses WCF. I need to have
I have a project that I have recently started working on seriously but had
I've been trying to get WCF security working for my project, and have had
I have a project using WCF which was working fine, but I moved the
I have a simple WCF project that uses the Entity Framework to access the
I'm working on a project that uses wcf webapi to expose all it's functionality

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.