Stackify not using proxy in ASP.NET Core

479 views Asked by At

In a ASP.Net Core website I am using NLog with a StackifyTarget to log to Stackify Retrace. Our code is running behind a corporate HTTP proxy.

I have some custom code that returns a WebProxy. The WebProxy is then set on StackifyLib.Utils.HttpClient.CustomWebProxy, in the Configure method of the StartUp.cs.

When a log is written, it is written successfully to file, but not to the StackifyTarget.

When I investigate the network traffic using Fiddler, I can see that there are 407/Proxy AuthenticationRequired errors for outbound traffic to the Stackify servers.

Using the same StackifyTarget in a WinForms application, .Net Framework 4.7.2, it just works fine:

<system.net>
    <defaultProxy useDefaultCredentials="true" />
</system.net>

When I set a breakpoint on the Log.Info, I can see that the proxy information is still set on the StackifyLib. How can have StackifyLib work correctly with the proxy, in ASP.Net Core?

2

There are 2 answers

0
Rolf Kristensen On BEST ANSWER

The custom code that assigns proxy to CustomWebProxy could also try and assign this first:

System.Net.WebRequest.DefaultWebProxy = webProxy;

As the very first thing in the application, before Stackify-HttpClient is created.

0
James Kenney On

Stackify has 2 docs that may help with this: https://docs.stackify.com/docs/troubleshoot-errors-and-logs-net-configurations https://docs.stackify.com/docs/http-proxies-configure

If either of these do not work you can submit a ticket to them to [email protected]