【发布时间】:2017-12-04 13:14:55
【问题描述】:
我需要通过代理实现ApplicationApplication。
var config = new TelemetryConfiguration
{
InstrumentationKey = "key",
TelemetryChannel = new Microsoft.ApplicationInsights.Channel.InMemoryChannel()
};
var client = new TelemetryClient(config);
我的电脑上有一个 WPF 应用程序(启用了防火墙)与某个服务器通信,我只需要代理所有 AppInsights 请求,其余的不需要。
我可以在每次 AppInsights 请求时设置一个代理并最终清理它,但与服务器的通信会不断进行,并且在 AppInsigns 请求时可能会发生“正常”请求,这不需要代理.
WebRequest.DefaultWebProxy = new WebProxy("myproxy"); //so does not fit (that's bs)
_telemetry.TrackEvent(key, properties, metrics);
Flush();
WebRequest.DefaultWebProxy = WebRequest.GetSystemWebProxy();
我该如何解决这种情况?提前谢谢你。
【问题讨论】: