Added back AppInsights

This commit is contained in:
Brett Hewitson 2023-03-08 23:56:16 +10:00
parent 89c1e1d55c
commit 6865361069
4 changed files with 5 additions and 6 deletions

View file

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ServerManager.WebApplication; namespace ServerManager.WebApplication;
@ -17,8 +16,4 @@ public class Program
{ {
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
}); });
//.ConfigureLogging((hostingContext, options) =>
//{
// options.AddApplicationInsights();
//});
} }

View file

@ -16,9 +16,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup> </ItemGroup>

View file

@ -57,6 +57,7 @@ public class Startup
}); });
services.AddHealthChecks(); services.AddHealthChecks();
services.AddApplicationInsightsTelemetry();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View file

@ -11,6 +11,9 @@
} }
} }
}, },
"ApplicationInsights": {
"InstrumentationKey": ""
},
"EnableSwagger": true, "EnableSwagger": true,
"SwaggerRoutePrefix": "", "SwaggerRoutePrefix": "",