0
我正在使用文檔數據庫,並且一些文檔可能會變得非常大以至於超過了大小限制(2MB)。我想存儲大塊作爲附件,這是我的代碼片段:在DocumentDB中創建附件時無效的請求有效負載錯誤
var stringifiedItems = JsonConvert.SerializeObject(doc.Items);
var attachmentStream = new MemoryStream(Encoding.UTF8.GetBytes(stringifiedItems));
doc.Attachment = await _client.CreateAttachmentAsync(GetDocumentLink(docId), attachmentStream, new MediaOptions()
{
ContentType = "application/json",
Slug = "Items.json"
});
但CreateAttachmentAsync()調用總是拋出一個一般性的錯誤:
"The request payload is invalid. Ensure to provide a valid request payload."
有人可以揭示光我錯過了我的代碼,或給出如何排除故障的建議?
非常感謝你!這解決了我的問題。 – Jiaye
@Jayaye如果帖子有助於解決問題,您可以將其作爲回答接受,以便其他具有相同問題的社區可以輕鬆識別答案。 –