c# - 在 C# 中调用 post api 方法,而您必须设置代理服务器和端口
问题描述
我必须从服务器调用 post 方法,这迫使我使用特殊的代理服务器和端口。我已经通过下面的代码在 c# 中调用了 post 方法,但是现在,我找不到任何设置特殊代理的地方。请帮助我,非常感谢
public HttpResponseMessage Authenticate(AuthenticateDTO entity)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://restapi.x.com/SuperClient/V1/APIAUTHENTICATE");
var response = client.PostAsJsonAsync("SuperClient/V1/APIAUTHENTICATE", entity).Result;
if (response.IsSuccessStatusCode)
{
Console.Write("Success");
}
else
Console.Write("Error");
}
return null;
}
解决方案
推荐阅读
- sharepoint-2019 - Google 图表是否在 SharePoint 2019 中运行?
- python - 如何在 django cms 页面模板上显示 django 模型数据
- c# - LiteDB 更新集合
- java - 使用软键盘时,BottomAppBar 会升高
- gitlab - 在管道成功完成时发送电子邮件/webhook 调用
- r - 如何生成 X 元素长或更少的有序子集数据帧
- python - Python中记忆斐波那契数列的问题
- arm - C 语言中的 ARM NEON 内在函数
- r - 如何使用R为df列中包含的相同值分配相同的名称
- python - 如何在发送到 Spring Boot 休息控制器的请求正文中保持换行符