Indifference
Indifference

Reputation: 1

Sending an Image from WP7 to WCF and converting to Bitmap

I'm trying to send a picture from my Windows Phone to a WCF service, which needs a System.Drawing.Bitmap. I however, am not able to take the BitmapImage from my phone, and get a Bitmap on the WCF service. I'm doing this in C#.

I've tried making the BitmapImage into a byte[], sending it over the WCF, and converting it back to a BitmapImage, and then converting that to a Bitmap. I can get the size of the BitmapImage, but the data in the image is empty. Any clues to what could go wrong?

How do I do this?

Upvotes: 0

Views: 577

Answers (1)

naqvitalha
naqvitalha

Reputation: 793

The problem probably is with the maxReceivedMessageSize. You said that you can get the size of the BitmapImage but is it the correct size? If not then add the following line in your WCF's web.config:

<bindings>
  <wsHttpBinding>
    <binding name="wsHttp"
                 maxReceivedMessageSize ="50000000"
                 messageEncoding="Mtom"
                 maxBufferPoolSize="50000000" >
      <readerQuotas maxDepth="32"
         maxStringContentLength="2147483647"
         maxArrayLength="2147483647"
         maxBytesPerRead="8192"
         maxNameTableCharCount="2147483647" />
    </binding>
  </wsHttpBinding>
</bindings>

Now try again, it should work now.

Upvotes: 1

Related Questions