problem with returning bitmap from wcf service RRS feed

  • Question

  • Hi,

    What's the correct way of returning an image from a web service?  I'm returning a Bitmap object right now, but when i add the reference to the webservice reference in my silverlight app, under intellisense all it shows is reference.Bitmap.... and hides all the other methods in the wcf service ?  I thought i'd convert this bitmap to bitmapimage and then bind this to the source of image but i can't seem to refer the wcf method itself.

    Wednesday, September 2, 2009 5:41 AM


All replies

  • Hi,

    check the following link for retrieving Image from database :


    HTH Smile

    Wednesday, September 2, 2009 5:53 AM
  • This is my code:


    Interface IService


    Bitmap GetPhoto(int iPhoto_ID);




    class Implelentation:IService{

    public Bitmap GetPhoto(){

    Bitmap bmp= businessLogic.GetPhoto(iPhoto_ID);

    return bmp;





    Are there any issues returning bitmaps from wcf service?  If so what is the best way? Right now I'm still not able to access my web method from silverlight.

    I've tried returning:

    1.  Bitmap from wcf service: in which case intellisense does not show any of the methods in the xaml.cs and all it says is "Bitmap" for reference.

    2. Byte[] from wcf service: same as above

    3. BitmapImage: It cannot add the service reference in silverlight

    4. MemoryStream: In which case it says that stream is not serialized.

    Wednesday, September 2, 2009 7:48 AM
  • Hi,

    The sample referenced by the link in varshavmane's reply can suit your condition.  Did you take this and have a test? 

    Best regards,


    Tuesday, September 8, 2009 11:13 PM