从具有“ Microsoft.AspNetCore.OData”中间件的服务器发出批处理请求,并向另一台具有业务逻辑api的服务器发出请求

时间:2019-07-01 06:08:40

标签: c# .net-core asp.net-core-mvc odata asp.net-core-webapi

考虑以下情况(原始情况)

客户端http批处理请求-> 服务器A(Odata中间件)-> 服务器B(业务逻辑api)

我正在尝试在包含“ Microsoft.AspNetCore.OData”中间件的服务器A上发送批处理请求,该中间件应再次调用服务器B Api并获得批处理响应。所以我的请求标头或我缺少的任何概念是否有问题在这里?

当我尝试以下情形时,

客户端http批处理请求-> 服务器A(Odata中间件和业务逻辑api)

在这种情况下,我得到了适当的答复,但是当我尝试原始情况时,却得到了http 404找不到。

这是我正在发出的Http请求:

POST /odata/$batch HTTP/1.1
Host: localhost:44327
Content-Type: multipart/mixed; boundary=batch_357aa73-edfc88d8866e
Content-Transfer-Encoding: binary
User-Agent: PostmanRuntime/7.15.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 6byf3d44-810a-444e-9a5a-07aeg8ba2-4754-g684-23a2c25294b6
Host: localhost:44327
accept-encoding: gzip, deflate
content-length: 1227
Connection: keep-alive
cache-control: no-cache

--batch_357aa73-edfc88d8866e
Content-Type: application/http
Content-Transfer-Encoding: binary

POST https://localhost:44367/api/PostSomeData HTTP/1.1
Host: localhost:44367
Content-Type: application/json; 

{
// Some json request body
}

--batch_batch_357aa73-edfc88d8866e
Content-Type: application/http
Content-Transfer-Encoding: binary

POST /api/v1/Snmp/PostSomeMoreData HTTP/1.1
Host: localhost:44367
Content-Type: application/json; 

{
// Some json request body
}

--batch_batch_357aa73-edfc88d8866e

以下是我现在针对原始案例的答复,

--batchresponse_53ff4ebf-2fa9-4497-8843-e12333e19782
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 404 Not Found


--batchresponse_53ff4ebf-2fa9-4497-8843-e12333e19782
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 404 Not Found


--batchresponse_53ff4ebf-2fa9-4497-8843-e12333e19782--

任何想法如何纠正它?

0 个答案:

没有答案