Windows azure REST API to List containers issue

后端 未结 1 689
温柔的废话
温柔的废话 2021-01-16 16:12

I\'m trying to list the containers in my windows azure storage account. but i\'m struck with an exception
\"The remote server returned an error: (403) Server failed to

相关标签:
1条回答
  • 2021-01-16 16:44

    Please change your StringToSign to:

            string StringToSign = String.Format("GET\n"
                + "\n" // content encoding
                + "\n" // content language
                + "\n" // content length
                + "\n" // content md5
                + "\n" // content type
                + "\n" // date
                + "\n" // if modified since
                + "\n" // if match
                + "\n" // if none match
                + "\n" // if unmodified since
                + "\n" // range
                + "x-ms-date:" + dataStr + "\nx-ms-version:2014-02-14\n" // headers
                + "/{0}/\ncomp:list", Account);//Notice an extra "/" after "{0}"
    

    It was missing a / after account name placeholder (last line in the code above). Once you do that, you should be able to see the list of containers returned in XML format.

    0 讨论(0)
提交回复
热议问题