This commit is contained in:
Yun-Ting 2023-10-03 10:35:48 -07:00
Родитель 579d0520d2
Коммит c09d901d7b
5 изменённых файлов: 99 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0-beta3-build00561" />
</ItemGroup>
<!--<ItemGroup>
--><!--<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0-beta3" />--><!--
<ProjectReference Include="C:\repos\ApplicationInsights-dotnet\BASE\src\Microsoft.ApplicationInsights\Microsoft.ApplicationInsights.csproj" />
</ItemGroup>-->
</Project>

27
ConsoleApp1/Program.cs Normal file
Просмотреть файл

@ -0,0 +1,27 @@
using System;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
namespace MyApp
{
internal class Program
{
static void Main(string[] args)
{
var key = "APPLICATIONINSIGHTS_LOG_DIAGNOSTICS";
var value = @"C:\home\LogFiles\SelfDiagnostics";
//var value = "C:\\home\\LogFiles\\Application\\Functions\\";
Environment.SetEnvironmentVariable(key, value);
Console.WriteLine("Hello, World!");
Console.WriteLine(Directory.GetCurrentDirectory());
TelemetryClient client = new TelemetryClient();
for (int i = 0; i < 10000; i++)
client.TrackTrace("sd" + i);
client.Flush();
Thread.Sleep(10000);
}
}
}

Просмотреть файл

@ -6,5 +6,6 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="LocalRelease" value="C:\repos\ApplicationInsights-dotnet\bin\Release\NuGet" />
</packageSources>
</configuration>

Просмотреть файл

@ -0,0 +1,31 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var key = "APPLICATIONINSIGHTS_LOG_DIAGNOSTICS";
var value = @"C:\home\LogFiles\SelfDiagnostics";
Environment.SetEnvironmentVariable(key, value);
builder.Services.AddApplicationInsightsTelemetry();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

Просмотреть файл

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0-beta3" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<!--<ProjectReference Include ="C:\repos\ApplicationInsights-dotnet\NETCORE\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj" />-->
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0-beta3-build00561" />
</ItemGroup>
</Project>