【问题标题】:Endpoint not found in wcf Get Method but OK in Post methods在 wcf Get 方法中找不到端点,但在 Post 方法中可以
【发布时间】:2017-05-28 10:32:55
【问题描述】:

我有 wcf 休息服务。

我编写了 POST 方法和 GET 方法。 直到几天前都工作正常,但突然 Post 工作正常,但所有 Get 方法都返回“找不到端点”。 我已经检查了数百万次 Url 模板,但一切正常。 这是我的代码:

    [OperationContract]
    [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json,ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "AddActivities")]
    AddActivitiesResponse AddActivities(List<Activity> activities);

    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetGeoLocation/{fullAddress}/{account}")]
    GetGeoLocationResponse GetGeoLocation(string fullAddress, string account);

【问题讨论】:

    标签: c# wcf restful-url


    【解决方案1】:

    对不起,我的错。我请求了错误的 url tempalte。 我发送了 GetGeoLocation?fullAddress=NY 但我应该发送 GetGeoLocation/NY

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多