diff --git a/PlanB.Butler.Admin/PlanB.Butler.Admin/Connected Services/Application Insights/ConnectedService.json b/PlanB.Butler.Admin/PlanB.Butler.Admin/Connected Services/Application Insights/ConnectedService.json new file mode 100644 index 0000000..d7fabdb --- /dev/null +++ b/PlanB.Butler.Admin/PlanB.Butler.Admin/Connected Services/Application Insights/ConnectedService.json @@ -0,0 +1,7 @@ +{ + "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", + "Version": "16.0.0.0", + "GettingStartedDocument": { + "Uri": "https://go.microsoft.com/fwlink/?LinkID=798432" + } +} \ No newline at end of file diff --git a/PlanB.Butler.Admin/PlanB.Butler.Admin/PlanB.Butler.Admin.csproj b/PlanB.Butler.Admin/PlanB.Butler.Admin/PlanB.Butler.Admin.csproj index 5369052..bbfff2f 100644 --- a/PlanB.Butler.Admin/PlanB.Butler.Admin/PlanB.Butler.Admin.csproj +++ b/PlanB.Butler.Admin/PlanB.Butler.Admin/PlanB.Butler.Admin.csproj @@ -5,6 +5,7 @@ 82b45153-dea6-42fe-94f4-c897cc45ea91 Windows PlanB. GmbH + /subscriptions/0b2d10f3-ce35-4020-a415-33e1455eed50/resourcegroups/PlanButlerV2/providers/microsoft.insights/components/planbutlerbotservicev2 @@ -43,6 +44,10 @@ + + + + diff --git a/PlanB.Butler.Admin/PlanB.Butler.Admin/Startup.cs b/PlanB.Butler.Admin/PlanB.Butler.Admin/Startup.cs index 45401bf..aaa983c 100644 --- a/PlanB.Butler.Admin/PlanB.Butler.Admin/Startup.cs +++ b/PlanB.Butler.Admin/PlanB.Butler.Admin/Startup.cs @@ -1,7 +1,11 @@ +// Copyright (c) PlanB. GmbH. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; @@ -13,27 +17,40 @@ namespace PlanB.Butler.Admin { + /// + /// Startup. + /// public class Startup { + /// + /// Initializes a new instance of the class. + /// + /// The configuration. public Startup(IConfiguration configuration) { - Configuration = configuration; + this.Configuration = configuration; } + /// + /// Gets the configuration. + /// + /// + /// The configuration. + /// public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. + /// + /// This method gets called by the runtime. Use this method to add services to the container. + /// + /// The services. public void ConfigureServices(IServiceCollection services) { + // The following line enables Application Insights telemetry collection. + services.AddApplicationInsightsTelemetry(); + services.AddControllersWithViews(); - //Set 5 min as the lifetime for the HttpMessageHandler objects in the pool used for the Catalog Typed Client services.AddHttpClient() .SetHandlerLifetime(TimeSpan.FromMinutes(5)); - - //services.AddHttpClient(client => - //{ - // client.BaseAddress = new Uri("https://planbbutlerservices.azurewebsites.net/api/"); - //}); } /// @@ -50,9 +67,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) else { app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } + app.UseHttpsRedirection(); app.UseStaticFiles(); diff --git a/PlanB.Butler.Admin/PlanB.Butler.Admin/Views/Shared/_Layout.cshtml b/PlanB.Butler.Admin/PlanB.Butler.Admin/Views/Shared/_Layout.cshtml index c78c404..d1aca8a 100644 --- a/PlanB.Butler.Admin/PlanB.Butler.Admin/Views/Shared/_Layout.cshtml +++ b/PlanB.Butler.Admin/PlanB.Butler.Admin/Views/Shared/_Layout.cshtml @@ -1,4 +1,5 @@ - +@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet + @@ -6,6 +7,7 @@ @ViewData["Title"] - PlanB.Butler.Admin + @Html.Raw(JavaScriptSnippet.FullScript)