问题
Seemingly randomly I am unable to get a document from DocumentDB. I can be debugging, have it fail with the below message then try again and work. If this has to do with my MAC address i've also tried from a different workstation with the same result.
Microsoft.Azure.Documents.UnauthorizedException, message: {"Errors":["The MAC signature found in the HTTP request is not the same as the computed signature. Server used following string to sign - 'post\ndocs\nmo1oanohoga=\nwed, 25 feb 2015 12:35:57 gmt\n\n'"]}
How do I even go about a) reporting this and b) trying to fathom out what's going on?
回答1:
We have confirmed this to be an issue isolated to the North Europe region. We are applying a hotfix to known accounts effected and will be deploying a fix shortly.
If you are NOT in North Europe and are experiencing this issue, or if you continue to see if within 2-3 days of this response, please reach out to us again so we can investigate further.
回答2:
I had the same problem. But the error was mine.
To fix i've changed the Uri method.
Before:
this._documentCollectionUri = UriFactory.CreateDocumentUri(this._dataBaseName, this._collectionName, this._dataBaseName);
Now:
this._documentCollectionUri = UriFactory.CreateDocumentCollectionUri(this._dataBaseName, this._collectionName);
a lack of attention or care
flw
回答3:
There seems to be a peculiar regression in the 1.9 version of the SDK that can cause this error to be raised. I appreciate that this has nothing to do with the original question, but if you search for this error you land here, so thought it would be an appropriate place to post it.
This (wrong) code will give different error messages in SDK 1.8 and 1.9:
docClient.CreateDocumentCollectionQuery(
UriFactory.CreateDocumentCollectionUri(DbName, CollectionName))
.Where(c => c.Id == CollectionName).ToList().Any()
In 1.8 you will correctly get ResourceType Collection is unexpected.
In 1.9 you will get The MAC signature found in the HTTP request is not the same as the computed signature. Server used following string to sign...
It looks like 1.9 for some reason returns the wrong error message (the one referenced by the OP) but as it is completely misleading you are going to have a hard time tracking down the problem.
To be clear; the code I posted is wrong. The problem I am explaining is that SDK version 1.9 returns the wrong error message.
回答4:
Can you please check if your system clock time is significantly different (< 5 minutes or greater than 20 minutes) from the one returned by the error message? This error can be returned due to clock skew. If that's the case, updating your clock time might resolve this issue.
The DocumentDB client constructs a Message Authentication Code (MAC) using the master key and the timestamp of the request to authenticate requests. The service rejects requests with a MAC outside of a small time window for security reasons.
来源:https://stackoverflow.com/questions/28723398/azure-documentdb-the-mac-signature-found-in-the-http-request-is-not-the-same-a