Azure存储REST组事务-其中一个请求输入超出范围



我正在尝试用一个非常简单的请求处理实体组事务,但在响应中不断收到"400(其中一个请求输入超出范围)"错误代码。这是序列化的字符串HttpRequestMessage:

Method: POST, RequestUri: 'http://127.0.0.1:10002/$batch?', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  x-ms-date: Tue, 21 Oct 2014 18:49:09 GMT
  x-ms-version: 2014-02-14
  Authorization: SharedKeyLite devstoreaccount1:vdQ+5/Kmw43u+DcqpWCX14n24WG8hsubtTK5pnK1xO8=
  Content-Type: multipart/mixed; boundary=batch_f351702c-c8c8-48c6-af2c-91b809c651ce
  Content-Length: 212
}

并且字符串序列化请求内容:

--batch_f351702c-c8c8-48c6-af2c-91b809c651ce
Content-Type: application/http
Content-Transfer-Encoding: binary
GET http://127.0.0.1:10002/batchTable() HTTP/1.1
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce--

来自服务器的响应:

StatusCode: 400, ReasonPhrase: 'One of the request inputs is out of range.', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  x-ms-request-id: 43fea847-2226-4dcf-ad62-bdb7cc0af256
  Date: Wed, 22 Oct 2014 00:00:06 GMT
  Server: Microsoft-HTTPAPI/2.0
  Content-Length: 325
  Content-Type: application/xml
}

响应内容:

<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>OutOfRangeInput</m:code><m:message xml:lang="en-US">One of the request inputs is out of range.
RequestId:43fea847-2226-4dcf-ad62-bdb7cc0af256
Time:2014-10-22T00:00:06.3046099Z</m:message></m:error>

你知道可能是什么问题吗?

谢谢!

编辑:混淆授权标头不会导致403错误,以防有帮助。

编辑2:如果我尝试批量处理单个插入,我也不会出错,但插入也不会发生:

Method: POST, RequestUri: 'http://127.0.0.1:10002/devstoreaccount1/$batch?', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  Accept: application/atom+xml
  x-ms-date: Wed, 22 Oct 2014 16:38:34 GMT
  x-ms-version: 2014-02-14
  DataServiceVersion: 1.0
  MaxDataServiceVersion: 3.0
  Authorization: SharedKeyLite devstoreaccount1:Eb4JHmCsuL6aLMTGEWs+gt23zbKjAdYjO12YmeYHjf0=
  Content-Type: multipart/mixed; boundary=batch_boundary
  Content-Length: 1008
}

Content.ToString():

--batch_boundary
Content-Type: multipart/mixed; boundary="changeset_boundary"
Content-Length: 885
--changeset_boundary
Content-Type: application/http
Content-Transfer-Encoding: binary
POST http://127.0.0.1:10002/devstoreaccount1/batchTable? HTTP/1.1
Content-ID: 1
Content-Type: application/atom+xml;type=entry
Content-Length: 559
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title />
  <updated>2014-10-22T16:38:34.6393109Z</updated>
  <author>
    <name />
  </author>
  <id />
  <content type="application/xml">
    <m:properties>
      <d:PartitionKey m:type="Edm.String">foo</d:PartitionKey>
      <d:RowKey m:type="Edm.String">foo</d:RowKey>
      <d:IntVal m:type="Edm.Int32">1</d:IntVal>
    </m:properties>
  </content>
</entry>
--changeset_boundary--
--batch_boundary--

问题是URI是http://127.0.0.1:10002/$batch而不是http://127.0.0.1:10002/devstoreaccount1/$batch叹息

看起来您使用的是较旧版本的Azure Storage Emulator,该版本不支持2014-02-14版本。请确保Emulator的版本至少为3.2?如果不是,请升级到最新版本。

最新更新