【问题标题】:OData $batch from Postman来自 Postman 的 OData $batch
【发布时间】:2020-01-07 17:06:32
【问题描述】:

我正在尝试在邮递员中发布 OData 批处理请求。

网址:

http://localhost:52484/$batch

标题:

Content-Type : multipart/mixed; boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77b

正文(原始):

--batch_36522ad7-fc75-4b56-8c71-56071383e77b 
 Content-Type: application/http 
 Content-Transfer-Encoding:binary 

 GET /Schools?$top=1
 Host: host   

--batch_36522ad7-fc75-4b56-8c71-56071383e77b 

但出现以下错误:

{
"Message": "No HTTP resource was found that matches the request URI 'http://localhost:52484/%24batch'.",
"MessageDetail": "No route providing a controller name was found to match request URI 'http://localhost:52484/%24batch'"
}

知道请求中缺少什么吗?

【问题讨论】:

    标签: asp.net-web-api odata postman


    【解决方案1】:

    请检查您是否正确配置了 OData 路由和 batchHandler,如下所示:

    ODataBatchHandler odataBatchHandler = new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer);
    odataBatchHandler.MessageQuotas.MaxOperationsPerChangeset = 10;
    odataBatchHandler.MessageQuotas.MaxPartsPerBatch = 10;
    
    config.MapODataServiceRoute(
        routeName: "ODataRoute",
        routePrefix: null,
        model: builder.GetEdmModel(),
        batchHandler: odataBatchHandler
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-22
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多