如何为任何请求使用.NET Core 3.1为HTTP客户端设置默认代理? [英] how to set default proxy with .NET core 3.1 for HTTP client for any request?

查看:131
本文介绍了如何为任何请求使用.NET Core 3.1为HTTP客户端设置默认代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用interfax.api dll向用户发送传真.如何添加代理服务器配置以将传真发送给用户.实际上,我想在.net core中启用代理服务器设置.最好的方法是什么?

I am using interfax.api dll to send faxes to users. how I can add proxy server configurations to send the fax to users. actually I want to enable proxy server settings in .net core. what is best way to do it?

推荐答案

该问题似乎与interfax api无关.可以通过将代理uri添加到您的.net核心项目中来解决此问题

the issue not seems to be with interfax api. this can be solved with adding proxy uri to your .net core project like that

HttpClient.DefaultProxy = new WebProxy("http://192.168.6.129:3128/", true);

在您的启动类ConfigureServices方法中

in your startup class ConfigureServices method

这篇关于如何为任何请求使用.NET Core 3.1为HTTP客户端设置默认代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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