private async Task RetrieveConfigurationAsync() { //@{ var dataFileName = Environment.GetEnvironmentVariable("HOME").ToString() + "\\site\\wwwroot\\data.txt"; } Option 1 //Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, "file_at_root.txt"); try { await Task.Run(() => { string configPath = ""; if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HOME"))) { configPath = Environment.GetEnvironmentVariable("HOME") + "\\site\\wwwroot\\"; } else { configPath = System.Environment.CurrentDirectory; } var builder = new ConfigurationBuilder().SetBasePath(configPath).AddJsonFile("appsettings.json", false, true); var config = builder.Build(); helperConfig = config.GetSection("InfoBloxHelper").Get <HelperConfiguration>(); CreateAutorizationContextAsync().Wait(); acceptAnySsl = helperConfig.AcceptAnySsl; SslBypassCheckAsync().Wait(); infoBloxSubnets = GetNetworkListsAsync().Result; if (!String.IsNullOrEmpty(helperConfig.DefaultNetworkCIDR)) { if (NetworkUtilities.ValidateCidrIp(helperConfig.DefaultNetworkCIDR).Value) { //defaultSubnet = instance.GetNetworkAsync(helperConfig.DefaultNetworkCIDR).Result; var _subnetResult = from subnet in infoBloxSubnets where (subnet.Network == helperConfig.DefaultNetworkCIDR) select subnet; defaultSubnet = _subnetResult.FirstOrDefault(); } } else { //defaultSubnet = instance.GetNetworkAsync(helperConfig.DefaultNetworkCIDR).Result; var _subnetResult = (from subnet in infoBloxSubnets select subnet).Take(1); defaultSubnet = _subnetResult.FirstOrDefault(); } }); } catch (System.Exception) { throw; } }