PlanTempusApp/SetupInfrastructure/Program.cs

48 lines
1.6 KiB
C#

using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
namespace SetupInfrastructure
{
/// <summary>
/// SETUP APPLICATION USER NAMED sathumper
///
/// This should be handled on the Postgresql db server with a superadmin or similar.
///
/// Execute SQL CreateRole.txt
///
/// After that is executed it is time for running this main program
/// Remember to use the newly created sathumper
/// "ConnectionStrings": {
/// "ptdb": "Host=192.168.1.57;Port=5432;Database=ptdb01;User Id=sathumper;Password=<secret>;"
/// </summary>
internal class Program
{
static async Task Main(string[] args)
{
var telemetryChannel = new ServerTelemetryChannel();
var configuration = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
configuration.ConnectionString = "InstrumentationKey=2d2e76ee-5343-4691-a5e3-81add43cb584;IngestionEndpoint=https://northeurope-0.in.applicationinsights.azure.com/";
configuration.TelemetryChannel = telemetryChannel;
telemetryChannel.Initialize(configuration);
telemetryChannel.Send(item);
var log = new TelemetryClient(configuration);
log.TrackTrace("Console log med kanal 2");
log.Flush();
Console.WriteLine("Hello, World!");
await Task.Delay(5000);
Console.Read();
}
}
}