我正在尝试将Windows Phone中的图片发送到WCF服务,该服务需要System.Drawing.Bitmap。但是,我无法从手机中获取BitmapImage,并在WCF服务上获取Bitmap。我在C#中这样做。
我尝试将BitmapImage变成byte [],通过WCF发送,然后将其转换回BitmapImage,然后将其转换为Bitmap。我可以得到BitmapImage的大小,但图像中的数据是空的。什么可能出错的线索?
我该怎么做?
答案 0 :(得分:1)
问题可能出在maxReceivedMessageSize
上。你说你可以得到BitmapImage的大小,但它是正确的大小?如果没有,那么在WCF的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>
现在再试一次,现在应该可以了。