简体   繁体   中英

Stackify not using proxy in ASP.NET Core

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?

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.

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 support@stackify.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM