Ruddy Lee 分享空間

Emergent Design 演化設計

上傳Azure 應用程式,傳一半失敗了怎麼辦?

leave a comment »

上傳Azure 應用程式失敗後的回應

基於Google 瀏覽器上傳Azure 應用程式失敗的回應,程式設計人員可能要更進一步去看上傳時的狀態。也就是說;如果你的程式在上傳作業時就出了問題,那怎麼辦呢?!

(線上偵錯: Windows Azure SDK 1.3 已經可以運用IntelliTrace來進行雲端的偵錯了,

可以參考: http://www.dotblogs.com.tw/code6421/archive/2010/06/09/15741.aspx)

查看的方法: 寫程式,運用HTTP 1.1 Request method 來讀取目前非同步作業的上傳狀態(透過Windows Azure Service Management API):

採用Http的 Get 方法:

https://management.core.windows.net/<subscription-id>/operations/<request-id>

參數:   subscription-id: 你的 subscription ID,request-id: 在return 的 http header 內

一直到回傳值: 200 表示作業完成。 (在response的body 內會回傳: InProgress, Succeeded,Failed)

但如果Failed了呢? 只好去看回傳值了。

請注意: 所有的Service Management API都是透過HTTPS的而且一定要跟著你的 subscription ID.

當然,你也可以呼叫: GetDeployment 的API 來取得更多訊息。(http://msdn.microsoft.com/en-us/library/ee460804.aspx)

範例:  請參考Programming Windows Azure .Programming the Microsoft Cloud by: O’Reilly 出版的96頁( http://oreilly.com/catalog/9780596801984 ) 或是線上的http://books.google.com.tw/books?id=ANqnTECyE9oC&pg=PA101&lpg=PA101&dq=sample+azure+Update+Deployment+Status&source=bl&ots=vkmxxv6Sy0&sig=MScEUtIswn2YnP0aLnyNwW4nEsg&hl=zh-TW&ei=4zs6TaGRG4bqvQPf-I2kCg&sa=X&oi=book_result&ct=result&resnum=5&ved=0CDwQ6AEwBA#v=onepage&q&f=false

(範例,我正在寫…就在下一本Windows Azure Service Management API的書內,但以我的寫作速度的話…可能就遙遙無期了,不用等了!)

讀到Request之後,對照一下回傳值吧:

【回傳值: Bad Request (400)

1. MissingOrIncorrectVersionHeader

說明: The versioning header is not specified or was specified incorrectly.

2. InvalidXmlRequest

說明: The request body’s XML was invalid or not correctly specified.

3. MissingOrInvalidRequiredQueryParameter

說明: A required query parameter was not specified for this request or was specified incorrectly.

4. InvalidHttpVerb

說明: The HTTP verb specified was not recognized by the server or isn’t valid for this resource.

5. BadRequest

說明: A parameter was incorrect.

【回傳值: Forbidden (403)】

1.     AuthenticationFailed

說明: The server failed to authenticate the request. Verify that the certificate is valid and is
associated with this subscription.

2.     SubscriptionDisabled

說明: The subscription is in a disabled state.

回傳值: Forbidden (404)】

1.     ResourceNotFound

說明: The specified resource does not exist.

【回傳值: Conflict (409) ConflictError】

說明: A conflict occurred to prevent the operation from completing.

【回傳值: Internal Server Error (500)】

1.     InternalError

說明:The server encountered an internal error. Please retry the request.

2.     OperationTimedOut

說明: The operation could not be completed within the permitted time.

【回傳值: Service Unavailable (503)】

1.     ServerBusy

說明: The server (or an internal component) is currently unavailable to receive requests. Please retry
your request.

關鍵的SDK 1.3 版的Microsoft.Samples.WindowsAzure.ServiceManagement.dll可以在安裝完Windows Azure Platform Training Kit 1.3版後找到。
(http://www.microsoft.com/downloads/en/details.aspx?FamilyID=413e88f8-5966-4a83-b309-53b7b77edf78&displaylang=en)

有關Windows Azure Service Management API 請參考:http://msdn.microsoft.com/en-us/library/ee460799.aspx

Written by ruddyllee

2011 年 01 月 22 日 於 11:09:39

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: