七牛使用者搭建c# sdk的圖文解說

來源:互聯網
上載者:User

標籤:

Qiniu 七牛問題解答

問題描述:很多客戶屬於小白類型。但是請不要隨便噴七牛的文檔站。因為需要一點http的專業知識才能瞭解七牛的api文檔。現在我給大家弄個c# sdk的搭建步驟

問題解決方案1,首先要在vs中安裝nuget

NuGet的安裝(我的開發環境是Visual Studio 2013 旗艦版,故以此為例):

主菜單->工具->擴充和更新,開啟如下介面,點擊左側的“聯機”搜尋nuget,然後搜尋到安裝。

2,應用nuget來安裝qiniu sdk

你可以右鍵你的項目,選擇管理你的nuget程式包。然後就可以選擇聯機,搜尋qiniu這個字串,點擊安裝。你的七牛c# sdk應用環境就搭建好了。

3,還需要一個外掛程式是json外掛程式

4,環境已經配好,現在要匯入七牛文檔的代碼到工程。(以上傳檔案的代碼為例子)
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebApplication1.IO; using Qiniu.Conf;namespace WebApplication1.Up { public partial class Upload : System.Web.UI.Page { public static void PutFile(string bucket, string key, string fname) { //ACCESS_KEY ,SECRET_KEY要去七牛背景秘鑰中擷取,bucket是在七牛後台建立的空間名字Qiniu.Conf.ACCESS_KEY = “” Qiniu.Conf.SECRET_KEY = “” var policy = new PutPolicy(bucket, 3600); string upToken = policy.Token(); PutExtra extra = new PutExtra (); IOClient client = new IOClient();   CallRet ret = client.PutFile(upToken, fname, key);  //ret中是七牛上傳後返回的一個資料類,你可以隨便調用裡面的欄位。(別告訴我不會用)            if (ret.OK)            {               // MessageBox.Show("ok");              //  MessageBox.Show(ret.Response);            }            else            {              //  MessageBox.Show(ret.Response);            }}}   }
結果示範

結果我不示範了,有問題去提交工單。在每個七牛文檔下面都有提交工單的途徑。

許可證

Copyright (c) 2012 qiniu.com

七牛使用者搭建c# sdk的圖文解說

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.