4

我想向 asp.net web api 控制器发送一个多部分/混合 http 请求 ($batch),如下所示:

--batch_fb0c-6847-2810
Content-Type: multipart/mixed; boundary=changeset_08b4-5b66-0d79

--changeset_08b4-5b66-0d79
Content-Type: application/http
Content-Transfer-Encoding: binary

POST People HTTP/1.1
Content-Id: 1
Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7,                 application/json;q=0.5, */*;q=0.1
DataServiceVersion: 1.0
Content-Type: application/json
MaxDataServiceVersion: 3.0

{"Id":1,"Task":"1","DueDate":"2013-02-    21T11:34:06.247","Completed":false,"University":1,"Degree":1}
--changeset_08b4-5b66-0d79
Content-Type: application/http
Content-Transfer-Encoding: binary

POST People HTTP/1.1
Content-Id: 2
Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7,     application/json;q=0.5, */*;q=0.1
DataServiceVersion: 1.0
Content-Type: application/json
MaxDataServiceVersion: 3.0

{"Id":4,"Task":"2","DueDate":"2013-02-21T11:34:06.247","Completed":false,"University":4,"Degree":4}

--changeset_08b4-5b66-0d79--

--batch_fb0c-6847-2810--

问题是我的请求没有路由到我的控制器中的正确操作,有没有解决方案来解决这个问题?!

4

1 回答 1

1

之前的答案已经过时了。批处理支持已添加到 Web API 项目,完整的文档在这里:

https://aspnetwebstack.codeplex.com/wikipage?title=Web+API+Request+Batching

于 2013-05-30T02:34:18.447 回答