JsonServiceClient 添加路径到 url [英] JsonServiceClient adding path to url

查看:60
本文介绍了JsonServiceClient 添加路径到 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个 JsonServiceClient,用如下的 url 参数初始化:

I'm using a JsonServiceClient, initialized with the url parameter like:

  JsonServiceClient client = new JsonServiceClient("http://dis.dat/whatever/coolService");

  client.Post(new MyRequest{ Foo = "bar"});

但是当我检查输出 url 时,我可以看到该服务使用了不同的 URL,更准确地说

But when i check for the output url, I can see that the service used a different URL, more precisely

    http://dis.dat/whatever/coolService/json/reply/MyRequest

请求类型很简单

    public class MyRequest
    {
        public string Foo {get; set;}
    }

当然,我想防止这种行为.

Of course, I would like to prevent this behaviour.

谢谢

推荐答案

看来你应该使用 custom路线:

[Route("/")]
public class MyRequest
{
    public string Foo {get; set;}
}

这篇关于JsonServiceClient 添加路径到 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆