C# 请求服务端方式1

发布时间:2024年01月03日

var client = new HttpClient();
var request = new HttpRequestMessage
{
??? Method = HttpMethod.Post,
??? RequestUri = new Uri("http://192.168.2.155:8899/user/getTroubleInfo"),
??? Content = new FormUrlEncodedContent(new Dictionary<string, string>
??? {
??????? { "name", "1#失控落棒1#" },
??????? { "createtime", "2024-01-02 11:24:04" },
??????? { "time", "" },
??????? { "flag", "1" },
??????? { "path", "1#CST-->LOCA-->稳压器水位1#-->稳压器压力-->电加热器热功率" },
??? }),
};
using (var response = await client.SendAsync(request))
{
??? response.EnsureSuccessStatusCode();
??? var body = await response.Content.ReadAsStringAsync();
??? Console.WriteLine(body);
}

文章来源:https://blog.csdn.net/qq_14874791/article/details/135361245
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。