Re: WCF Images

Tech-Archive recommends: Fix windows errors by optimizing your registry



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hi eschneider,
\par
\par I've performed some further tests, with Bitmap/Image class member wrappered in a DataContract(and even within a custom MessageContract class). Here are some results I've found:
\par
\par ** I defined the new service and operation contract as below:
\par
\par =========
\par
\par [OperationContract]
\par ImageResponseMessage GetImage();
\par \}
\par ..............
\par [MessageContract]
\par public class ImageResponseMessage
\par \{
\par [MessageBodyMember]
\par public ImageData ResponseData;
\par \}
\par
\par [DataContract]
\par [KnownType(typeof(System.Drawing.Bitmap))]
\par public class ImageData
\par \{
\par [DataMember]
\par public string ImageName;
\par
\par [DataMember]
\par public System.Drawing.Image Picture;
\par \}
\par ===================
\par
\par when I try call the service method in client app(use the "Add ServiceReference" generated proxy class), it raise an error indicate
\par
\par "The maximum array length quota (16384) has been exceeded while reading XML data....."
\par
\par Then, I enlarge the "maxArrayLength" as below (at both service and client app's config file):
\par
\par ==============
\par <basicHttpBinding>
\par <binding name="basicHttpBinding.configuration" >
\par <security mode="None">
\par
\par </security>
\par <readerQuotas maxArrayLength="99999999" maxStringContentLength="999999999"/>
\par </binding>
\par </basicHttpBinding>
\par ==============
\par
\par then, the service call works correctly. Is this the error you also encounter and does this change helps on your case?
\par
\par Sincerely,
\par
\par Steven Cheng
\par
\par Microsoft MSDN Online Support Lead
\par
\par
\par Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@xxxxxxxxxxxxxx
\par
\par ==================================================
\par Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
\par
\par
\par
\par \pard\li720 --------------------
\par From: "eschneider" <eschneider@xxxxxxxxxxxxxxxx>
\par References: <eeJ9y$zsJHA.528@xxxxxxxxxxxxxxxxxxxx> <eHHkJE0sJHA.1208@xxxxxxxxxxxxxxxxxxxx> <Vy18hw2sJHA.4896@xxxxxxxxxxxxxxxxxxxxxx> <eSUfRQ7sJHA.5912@xxxxxxxxxxxxxxxxxxxx> <dQ2nomCtJHA.3576@xxxxxxxxxxxxxxxxxxxxxx>
\par Subject: Re: WCF Images
\par Date: Fri, 3 Apr 2009 14:35:10 -0500
\par
\par
\par Thats what I'm doing (VS add Reference), although in my case the Image is a
\par property on a data contract object passed back as shown in earlier message.
\par
\par The inner exception is:
\par at System.Net.HttpWebRequest.GetResponse()
\par at
\par System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
\par timeout)
\par
\par
\par \pard "
\par }