【问题标题】:Azure storage REST group transactions - one of the request inputs is out of rangeAzure 存储 REST 组事务 - 请求输入之一超出范围
【发布时间】:2014-12-17 02:52:21
【问题描述】:

我正在尝试使用非常简单的请求处理实体组事务,但在响应中不断收到“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--

【问题讨论】:

  • 是否也可以发布服务器的响应?

标签: c# rest azure azure-storage


【解决方案1】:

您使用的似乎是旧版本的 Azure 存储模拟器,它不支持 2014-02-14 版本。您能否确保您的模拟器版本至少为 3.2?如果不是,请升级到最新版本。

【讨论】:

  • v3.3.0.0,不幸的是:(。我在原帖中添加了更多信息。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2018-04-10
    • 2012-08-02
    • 2015-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-10
    • 2013-12-14
    • 2011-02-06
    相关资源
    最近更新 更多