我发现错误'远程服务器返回错误:(404)Not Found。
CloudBlockBlob blockBlob = container.GetBlockBlobReference("test.csv");
blockBlob.Properties.ContentType = "text/csv; charset=utf-8";
blockBlob.SetProperties();
SetProperties正在抛出错误。
我看过一些不调用SetProperties()的代码。在这种情况下,contenttype是否会保存到blob中?
我做了一些搜索,发现有些人建议检查小提琴手。
以下是小提琴手......
/ xxxevents?restype = container Result 404
/ xxxevents?restype = container结果201已创建(已调用Container.CreateIfNotExists)
现在它在创建blob时抛出错误。提供了请求和响应头..
404 HTTPS xxx.blob.core.windows.net /xxxevents/test.csv?comp=properties 215 application/xml waworkerhost:5500
PUT https://xxx.blob.core.windows.net/xxxevents/test.csv?comp=properties HTTP/1.1
User-Agent: WA-Storage/4.3.0 (.NET CLR 4.0.30319.18444; Win32NT 6.1.7601.65536)
x-ms-version: 2014-02-14
x-ms-blob-content-type: text/csv; charset=utf-8
x-ms-client-request-id: 2424933c-1bd7-49fd-998e-11d5499da03b
x-ms-date: Sun, 28 Sep 2014 07:16:04 GMT
Authorization: SharedKey xxx:tQ6DeUSVSq0TIaRjnVQoOgqNJIlHU5k1uay4loMeU04=
Host: xxx.blob.core.windows.net
Content-Length: 0
HTTP/1.1 404 The specified blob does not exist.
Content-Length: 215
Content-Type: application/xml
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 7845cafa-0001-0033-7d19-af2c68000000
x-ms-version: 2014-02-14
Date: Sun, 28 Sep 2014 07:15:53 GMT
真诚地感谢任何帮助
由于
答案 0 :(得分:2)
这是预期的行为。 SetBlobProperties()
方法只能在blob存储中的blob上调用。你需要做的是先上传blob。
假设您尝试从test.csv
文件夹上传C:\temp
文件,请执行以下操作:
CloudBlockBlob blockBlob = container.GetBlockBlobReference("test.csv");
blockBlob.Properties.ContentType = "text/csv; charset=utf-8";
blockBlob.UploadFromFile(@"C:\temp\test.csv", FileMode.Open);