1
votes

I'm geting an error 'The remote server returned an error: (404) Not Found.

 CloudBlockBlob blockBlob = container.GetBlockBlobReference("test.csv");
                            blockBlob.Properties.ContentType = "text/csv; charset=utf-8";
                            blockBlob.SetProperties();

The error is being thrown at SetProperties.

I have seen a few codes where they do not call SetProperties(). Does the contenttype get saved to the blob in such cases?

I did some search and found some people suggesting to check on fiddler.

The following is happening on fiddler..

/xxxevents?restype=container Result 404

/xxxevents?restype=container Result 201 Created ( Container.CreateIfNotExists called)

Now it throws an error while creating the blob.. Request and response headers provided..

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

Would sincerely appreciate any help

Thanks

1
Have you uploaded the blob?Gaurav Mantri
No, after creating the container I gave the calls mentioned..Arnab
I have successfully uploaded the BLOB using SAS. But now i have a challenge to download the blobs with the file name. Has anybody done this?ajinkya gaurkar

1 Answers

3
votes

This is expected behavior. SetBlobProperties() method can only be called on blobs which are there in your blob storage. What you would need to do is upload blob first.

Assuming you're trying to upload test.csv file from say C:\temp folder, here's what you would need to do:

            CloudBlockBlob blockBlob = container.GetBlockBlobReference("test.csv");
            blockBlob.Properties.ContentType = "text/csv; charset=utf-8";
            blockBlob.UploadFromFile(@"C:\temp\test.csv", FileMode.Open);