Azure表格白皮书提到,如果在处理数据时出现错误,x-ms-request-id对于发送给Microsoft很有用。如果我确实遇到了这样的错误,我希望我的try...catch代码块接受这个错误,并将其保存到某个地方以供将来分析。
此外,我还需要在表存储中提取ETag值。
如何提取此信息并在出现异常时使其可用?
HTTP/1.1 204 No Content
Content-Length: 0
ETag: W/"datetime'2008-10-01T15%3A27%3A34.4838174Z'"
x-ms-request-id: 7c1b5e22-831d-403c-b88a-caa4443e75cb发布于 2010-09-20 08:05:36
取决于您的客户端实现,但它们都是HTTP 1.1标头。
例如,(假设.NET WebRequest类)如下所示:
WebRequest request = WebRequest.Create("http://myazurestore.server.com");
....
WebResponse response = request.GetResponse();
string mSRequestId = response.Headers["x-ms-request-id"];将会起作用
编辑(用于存储客户端库) ...
如果您使用的是客户端库,则可以从CloudBlob上的属性集合中获取ETag
所以..。
Cloudblob blob = container.GetBlobReference("blobname.ext");
var eTag = blob.Properties.ETagProperties是一个blobProperties对象。它应该提供对大多数所需数据的访问。
MSDN:http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.blobproperties_members.aspx
发布于 2012-10-07 03:06:01
你可能想看看我在CodePlex上的开源Azure Table Storage Client项目。
Lucifure Stash允许轻松访问ETag以及HttpWebRequest和HttpWebResponse对象。
https://stackoverflow.com/questions/3746108
复制相似问题