Esempio n. 1
0
        /// <summary>
        /// Creates the channel for the new service, and sets the proxy server.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <returns>The new channel.</returns>
        private Channel CreateChannel(GoogleAdsConfig config)
        {
            if (config.Proxy == null)
            {
                Environment.SetEnvironmentVariable("http_proxy", null);
            }
            else
            {
                Environment.SetEnvironmentVariable("http_proxy", config.Proxy.Address.ToString());
            }

            // GRPC uses c-ares DNS resolver, which doesn't seem to work on some Windows machines.
            // Turn it off for now.
            // https://github.com/googleads/google-ads-dotnet/issues/59
            Environment.SetEnvironmentVariable("GRPC_DNS_RESOLVER", "native");

            return(CachedChannelFactory.GetChannel(config));
        }