wcf http 返回图片
2012-11-13 11:35
183 查看
做项目时候用wcf 返回图片,从官网上找了找一次只能返回一张图片,但是一直查不到返回多个图片的方法,ios 可以异步加载看速度也可以
,先记录一下等以后用解决了再发
http://msdn.microsoft.com/en-us/library/cc681221(v=vs.85).aspx
,先记录一下等以后用解决了再发
http://msdn.microsoft.com/en-us/library/cc681221(v=vs.85).aspx
[ServiceContract] public interface IImageServer { [OperationContract, WebGet] Stream GetImage(int width, int height); } public class Service : IImageServer { public Stream GetImage(int width, int height) { Bitmap bitmap = new Bitmap(width, height); for (int i = 0; i < bitmap.Width; i++) { for (int j = 0; j < bitmap.Height; j++) { bitmap.SetPixel(i, j, (Math.Abs(i - j) < 2) ? Color.Blue : Color.Yellow); } } MemoryStream ms = new MemoryStream(); bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); ms.Position = 0; WebOperationContext.Current.OutgoingResponse.ContentType = "image/jpeg";//可以换成其它格式的图片 return ms; } }
相关文章推荐
- kind editor 图片上传路径设置 urlType :domain ,返回带上http://
- HTTP请求一张图片,转为流返回
- Android--使用Http向服务器发送请求并取得返回结果,下载图片
- http请求返回图片及图片调整大小
- Django使用HttpResponse返回图片并显示的方法
- 通过HTTP请求图片,同时转为二进制流返回
- Django使用HttpResponse返回图片并显示
- PHP 有关上传图片时返回HTTP 500错误
- 使用 WCF Web HTTP 编程模型创建返回任意数据的服务
- WCF Http Get 方法返回 400 Bad Request
- HttpClient请求返回JSON、图片
- wcf 由 http 更改为 https 返回404,没有终结点在侦听可以接受消息的
- DataSnap Server HTTP json格式修改 返回图片
- Android--使用Http向服务器发送请求并取得返回结果,下载图片
- HTTP请求一张图片,转为流返回
- jQuery ajax 请求HttpServlet返回[HTTP/1.1 405 Method not allowed]
- ASP.NET HttpContext.Current在新建线程中会返回null
- HttpWebResponse远程服务器返回错误: (500) 内部服务器错误。
- HTTP通信:获取图片JSON格式并转化下载
- 基于google zxing二维码的生成,直接返回页面图片