【问题标题】:No routing convention was found to select an action for the OData path with template '~/entityset/key'没有找到路由约定来为带有模板“~/entityset/key”的 OData 路径选择操作
【发布时间】:2018-02-06 10:38:08
【问题描述】:

我有一个 API,它适用于以下场景的所有方法,但发布到 IIS 时的更新方法除外。 当我使用时,API的本地路径为http://localhost:87/调用API并且客户成功更新 当我将 API 路径更改为 http://ipaddress 或机器名称时:87/ 提琴手中出现错误,如下所示 内部错误: 消息=未找到路由约定以使用模板“~/entity set/key”为 O 数据路径选择操作。 消息=未找到与请求 URI 'http://ipaddress 或机器名称:87/evolution/Customers(客户的 GUID)'匹配的 HTTP 资源。 下面是 Ajax 调用:

            $.ajax({
            url: webServiceUrl + "/evol/Customers(" + customerId + ")",
            type: "PATCH",
            data: customer,
            crossDomain: true,
            xhrFields: {
                withCredentials: true
            },
            dataType: 'json',


            success: function (result) {
                debugger;
                alert(result.value);
            },
            error: function (result, request, status, error) {
                alert(error);
            }
        });

【问题讨论】:

    标签: ajax rest api odata


    【解决方案1】:

    我通过在 API 端的单独控制器中添加此方法解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2014-09-04
      • 2014-04-21
      • 2018-03-31
      • 2018-08-25
      • 2014-08-27
      • 1970-01-01
      • 2015-11-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多