TAILIEUCHUNG - Lập trình .net 4.0 và visual studio 2010 part 65

Bây giờ chúng ta đã làm việc với các StorageClient, tuy nhiên, tôi nghĩ rằng nó là hữu ích để hiểu những gì đang xảy ra đằng sau hậu trường. Trong ví dụ trước của chúng tôi, chúng tôi tạo ra một container để lưu trữ hình ảnh của chúng tôi, hình ảnh gọi là. Bây giờ chúng ta sẽ tạo ra một ứng dụng vào danh sách tất cả các thùng chứa trong Azure địa phương của chúng tôi lưu trữ bằng cách xây dựng theo yêu cầu HTTP nguyên | CHAPTER 16 WINDOWS AZURE Figure 16-18. Example blob application If you right-click on the image to examine its URL notice how the URL is made up of a number of properties we defined in our ServiceConfiguration AccountName pictures container and the GUID we used for the ID this URL is made up of IP PORT account container blobID . http 10000 devstoreaccount1 pictures 4d5eee66-162e-4fb1-afcb-197f08384007 . Accessing REST API Directly Now that we have worked with the StorageClient however I think that it is useful to understand what is happening behind the scenes. In our previous example we created a container to store our images called pictures. We will now create an application to list all the containers in our local Azure Storage by constructing the raw HTTP request. How Do We Work with the REST API To interface with the Azure Storage REST API we will construct a request using the WebRequest classes. We need to do the following 435 CHAPTER 16 WINDOWS AZURE 1. Make an HTTP request to a URL and port. The following URL for example is used to retrieve a list of containers held in Azure Storage http 10000 devstoreaccount1 devstoreaccount1 comp list 2. Set a number of headers in the request. 3. Set the HTTP verb of the request to describe what we are doing . GET PUT . 4. Calculate a hash of the headers we added and a hidden key. This ensures no one can modify the request and allows Azure Storage to authenticate us. 5. Azure Storage will then return our results as XML. Azure Storage authenticates each user by hashing the headers using SHA 256 with a shared secret key. If anyone tampers with a header or the wrong key is used then the hash will not match what Azure is expecting and it will return an HTTP 403 error not authenticated . Note that for additional security Azure messages expire after 15 minutes and will be rejected. Working with Azure Storage with Raw HTTP Requests Create a new Console application called . 1. Add the

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.