我的 .NET Core Web 应用程序在本地 IIS 上运行。我想使用 ApplicationInsights 跟踪应用程序。
在本地安装后,我没有收到任何事件(在开发中工作正常)-我有一个可以使用的 HTTP 代理,但我不知道如何为 ApplicationInsights() 设置它。
在我的 Startup.cs 中
services.AddApplicationInsightsTelemetry();
在我的 appsettings.Production.json 中
"ApplicationInsights": {
"ConnectionString": "<connectionstring_from_the_azure_portal>"
}
如何设置代理?
环境变量中添加的 HTTP_PROXY / HTTPS_PROXY 将由 ApplicationInsights 选取。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\your.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="HTTP_PROXY" value="http://proxyurl:1234" />
<environmentVariable name="HTTPS_PROXY" value="http://proxyurl:1234" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>