62,074
社区成员
发帖
与我相关
我的任务
分享
请教一下大神。对方写的接口方式在postman中是这样调用的http://106.12.253.61:5017/imageydwd?cate=camera&gudao=1&liewei=1,我写的C#程序去调用报错。不知道哪里写错误,报错无效的IP。C#程序如下:
用 RestSharp , 不要直接写请求
using RestSharp;
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
string url = "http://106.12.253.61/imageydwd?cate=camera&gudao=1&liewei=1";
var client = new RestClient(url);
var request = new RestRequest();
var response = client.Post(request);
Console.WriteLine(response.Content);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.Read();
}
}
}
你的ContentType很明显不是json的