1
0
Форкнуть 0

Set base path to current directory if ContentRootPath is null on hosting environment. This path is where AI would look for appsettings.json file for ikey, endpoint etc.

This commit is contained in:
Cijo Thomas 2018-06-11 15:06:07 -07:00
Родитель 8f42004f56
Коммит 5225f37c22
1 изменённых файлов: 2 добавлений и 1 удалений

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

@ -2,6 +2,7 @@
{
using System.Diagnostics;
using System.Globalization;
using System.IO;
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -28,7 +29,7 @@
public void Configure(ApplicationInsightsServiceOptions options)
{
var configBuilder = new ConfigurationBuilder()
.SetBasePath(this.hostingEnvironment.ContentRootPath)
.SetBasePath(this.hostingEnvironment.ContentRootPath??Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", true)
.AddJsonFile(string.Format(CultureInfo.InvariantCulture,"appsettings.{0}.json", hostingEnvironment.EnvironmentName), true)
.AddEnvironmentVariables();