[英]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 . 在ASP.Net Core网站中,我使用带有StackifyTarget的 NLog记录到Stackify Retrace 。 Our code is running behind a corporate HTTP proxy.
我们的代码在公司HTTP代理后面运行。
I have some custom code that returns a WebProxy. 我有一些返回WebProxy的自定义代码。 The WebProxy is then set on
StackifyLib.Utils.HttpClient.CustomWebProxy
, in the Configure method of the StartUp.cs . 然后,在
StackifyLib.Utils.HttpClient.CustomWebProxy
的Configure方法中的StackifyLib.Utils.HttpClient.CustomWebProxy上设置WebProxy。
When a log is written, it is written successfully to file, but not to the StackifyTarget. 写入日志后,它会成功写入文件,但不会成功写入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. 当我使用Fiddler调查网络流量时,可以看到对于Stackify服务器的出站流量存在407 / Proxy AuthenticationRequired错误。
Using the same StackifyTarget in a WinForms application, .Net Framework 4.7.2, it just works fine: 在WinForms应用程序.Net Framework 4.7.2中使用相同的StackifyTarget,它可以正常工作:
<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 . 当我在Log.Info上设置断点时,可以看到在StackifyLib上仍设置了代理信息。 How can have StackifyLib work correctly with the proxy, in ASP.Net Core?
StackifyLib如何与ASP.Net Core中的代理一起正常工作?
The custom code that assigns proxy to CustomWebProxy could also try and assign this first: 将代理分配给CustomWebProxy的自定义代码也可以尝试先分配以下内容:
System.Net.WebRequest.DefaultWebProxy = webProxy;
As the very first thing in the application, before Stackify-HttpClient is created. 作为应用程序中的第一件事,在创建Stackify-HttpClient之前。
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 Stackify有2个文档可以帮助解决这个问题: 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 如果这些都不起作用,您可以向他们发送故障单至support@stackify.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.