乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      wcf http 返回圖片

       昵稱10504424 2013-01-31


      做項(xiàng)目時(shí)候用wcf 返回圖片,從官網(wǎng)上找了找一次只能返回一張圖片,但是一直查不到返回多個(gè)圖片的方法,ios 可以異步加載看速度也可以

      ,先記錄一下等以后用解決了再發(fā)

      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;
          }
      }

        

      分類: c#, wcf
      綠色通道: 好文要頂 關(guān)注我 收藏該文與我聯(lián)系 
      bluejance
      關(guān)注 - 12
      粉絲 - 10
      +加關(guān)注
      1
      0
      (請您對文章做出評價(jià))
       博主上一篇:Linq 實(shí)現(xiàn) DataTable 行轉(zhuǎn)列
       博主下一篇:解決 wcf HTTP 無法注冊 另一應(yīng)用程序正在使用 TCP 端口 80
      posted @ 2012-11-13 11:35 bluejance 閱讀(295) 評論(0) 編輯 收藏

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多