我想将一个multipart / mixed http请求($ batch)发送到asp.net web api控制器,如下所示:
--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--
问题是我的请求没有路由到我的控制器中的正确操作,是否有任何解决方案来完成此问题?!
答案 0 :(得分:1)
之前的答案已过时。批处理支持已添加到Web API项目中,完整文档在此处:
https://aspnetwebstack.codeplex.com/wikipage?title=Web+API+Request+Batching