2013-10-14 28 views
5

對於我使用Azure blob存儲來存儲上傳的圖像文件的項目。我還在網站上顯示上傳的圖像 - 但是,這是出現問題的地方。在blobstorage中對圖像的每個其他請求都會導致400 - Multiple condition headers not supportedAzure blob存儲錯誤:不支持多個條件標頭

此錯誤讀了最終導致我下面的文檔有關指定條件的請求頭:http://msdn.microsoft.com/en-us/library/windowsazure/dd179371.aspx

那頁說以下有關指定多個條件標題:

If a request specifies both the If-None-Match and If-Modified-Since headers, the request is evaluated based on the criteria specified in If-None-Match.

If a request specifies both the If-Match and If-Unmodified-Since headers, the request is evaluated based on the criteria specified in If-Match.

With the exception of the two combinations of conditional headers listed above, a request may specify only a single conditional header. Specifying more than one conditional header results in status code 400 (Bad Request).

我相信發送的請求通過鉻滿足本文檔所述的所有要求,但我收到該錯誤。

有沒有人有Azure blob存儲的經驗可能有助於克服這個問題?我會很感激!

由鉻所發送的請求:

The request as sent by chrome

由Blob存儲服務返回的XML響應:

The XML response from the blob storage service

+3

您和Azure之間是否存在代理/緩存服務器,並添加它自己的條件標頭?當您從不同網絡(即從Azure VM)進行相同測試時會發生什麼? – kwill

+0

另外,你能告訴我們存儲在blob存儲中的文件有多大? –

+0

這些文件是最大的。 2mb大小,只是正常的圖像上傳真的。代理/緩存服務器是一個有趣的建議。我從Azure虛擬機測試了它,但無法重現錯誤,因此我假設我所在的共享辦公空間必須添加自己的緩存標頭。 但是,我們正在研究的網站應該被中型到大型公司的員工所使用 - 這類公司可能還會在其辦公室使用代理服務器/緩存服務器。我們可以做些什麼來解決這個問題? (通過我們的webrole路由請求短) –

回答

2

是的,它是因爲高速緩衝存儲器的,至少它是因爲我緩存。我正在使用SAS,因此我的解決方案是添加一個額外的參數以避免緩存。

/// token = SharedAccessSignature 
    string tick = $"&{ DateTimeOffset.UtcNow.Ticks}"; 
    Uri url = new Uri(file.StorageUri.PrimaryUri.ToString() + token + tick); 

該額外的參數應該被Web應用程序忽略。