Skip to content

Proxy Configuration

itsokto edited this page May 12, 2020 · 1 revision

Пример:

var serviceCollection = new ServiceCollection();
// Добавьте сконфигурированный HttpClient в ServiceCollection как Singleton
serviceCollection.AddSingleton(provider =>
{
    var httpClientHandler = new HttpClientHandler
    {
        Proxy = new WebProxy("127.0.0.1", 8888)
    };
    return new HttpClient(httpClientHandler);
});
// Передайте в конструктор VkApi serviceCollection
var vkApi = new VkApi(serviceCollection);