【问题标题】:Calling web service method from fiddler从提琴手调用 Web 服务方法
【发布时间】:2014-02-17 14:16:10
【问题描述】:

我有一个接受一个参数的网络服务。

Web服务方法:

[ActionName("GetCustomers")]

[HttpPost]

[AcceptVerbs("GET","HEAD")]

public bool getcustomers(string id)
{
    var result = JsonConvert.DeserializeObject<RootObject>(id.ToString());

    using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:\Result.txt"))
    {
        file.WriteLine(result);
    }

    return false;
}

如果我在提琴手的 url 下面运行..GetCustomer 方法正在调用....

url : http://localhost:49809/Import/GetCustomers/test

如果我通过屏幕截图中的 json 格式;

我的 webmethod 没有调用..让我知道为什么如果传递 json 格式它没有调用..给出错误:HTTP/1.1 404 Not Found

【问题讨论】:

    标签: web-services fiddler


    【解决方案1】:

    您需要将ContentType 更改为Content-Type 并删除其值周围的引号。

    该行应为:Content-Type: application/json;charset=UTF-8

    【讨论】:

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