.NET Core的IWebProxy实现的位置 [英] Location of IWebProxy implementation for .NET Core

查看:121
本文介绍了.NET Core的IWebProxy实现的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.Net.IWebProxy的可用实现是什么(来自System.Net.Primitives,DNX Core)?根据应用程序的要求,唯一的框架可以在dnxcore50中使用,那么包含代理实现的正确的NuGet包是什么?

What is the available implementation of the System.Net.IWebProxy (from System.Net.Primitives, DNX Core)? By application requirement, the only framework can be used in dnxcore50, so what is the right NuGet package that contains proxy implementations?

解决此类问题的正确方法是什么?相关功能似乎分散在许多软件包中。

What is the correct way to resolve such questions? Related functionality seems to be split among dozen of packages.

推荐答案

尽管如此,IWebProxy实现实际上并不需要实现任何代理。 ,它仅提供有关代理的信息。因此,您可以创建自己的实现:

Despite the name, IWebProxy implementation does not actually need to implement any proxying, it just provides information about the proxy. So, you can create your own implementation:

public class MyProxy : IWebProxy
{
    public Uri GetProxy(Uri destination)
    {
        return new Uri("http://localhost:8888");
    }

    public bool IsBypassed(Uri host)
    {
        return false;
    }

    public ICredentials Credentials { get; set; }
}

这篇关于.NET Core的IWebProxy实现的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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