Bid*_*idi 6 c# wcf windows-phone-7
我正在尝试将图像发送到wcf以使用OCR.现在,我成功地将我的图像转换为byte []并使用wcf将其发送到服务器.不幸的是,它适用于大小<16Kb的数组,不适用于> 17Kb的数组.
我已经设定readerQuotas,并maxArrayLength在服务器上的web.config文件大小其最大尺寸.
你知道如何将大数据发送到wcf服务器,或者任何库直接在wp7上使用OCR吗?
终于解决了。您必须更新 web.config 以允许服务器接收大数据。然后你必须在 WCF 中使用 Stream 类型,在 WP7 中使用 byte[] 类型。类型将匹配,并且 WCF 或 WP7 将同意接收和发送它。
在WCF中:
public string ConvertImgToStringPiece(Stream img)
{
//.....
}
Run Code Online (Sandbox Code Playgroud)
在 WP7 中:
Service1Client proxy = new Service1Client();
proxy.ConvertImgToStringPieceCompleted += new EventHandler<ConvertImgToStringPieceCompletedEventArgs>(proxy_ConvertImgToStringPieceCompleted);
proxy.ConvertImgToStringPieceAsync(b); //b is my Byte[], more thant 17Kb.
Run Code Online (Sandbox Code Playgroud)