I’m trying to pass a Bitmap through WCF, but it throws
System.ServiceModel.CommunicationException
was unhandled by user code
Message=The socket connection was
aborted. This could be caused by an
error processing your message or a
receive timeout being exceeded by the
remote host, or an underlying network
resource issue. Local socket timeout
was ’00:00:59.9650000′.
Any idea what might be causing this?
Thanks!
The cause is that the
Bitmaptype is a .NET specific type (with lots of Win32 specifics inside it, too) which isn’t serializable into XML. You can’t really pass it back as a parameter of a method – what you might be able to do is stream it back on a parameter of typeStreamand using streamed transfer in WCF.Or another way (if your bitmaps aren’t too big) would be to convert the
Bitmapinto a string, using Base64 encoding, send it back as a string, and then re-encode it on the client side.