In .net core mvc you can inject the configuration by adding the following two lines at the top of your view:
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
You can then access the value like this:
@Configuration.GetSection("ApplicationInsights")["InstrumentationKey"]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…