in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/TracingUtils.cs [17:61]
public static HostType GetHostType()
{
HostType hostType = HostType.Unidentified;
try
{
if (Environment.GetEnvironmentVariable(RequestTracingConstants.AzureFunctionEnvironmentVariable) != null)
{
hostType = HostType.AzureFunction;
}
else if (Environment.GetEnvironmentVariable(RequestTracingConstants.AzureWebAppEnvironmentVariable) != null)
{
hostType = HostType.AzureWebApp;
}
else if (Environment.GetEnvironmentVariable(RequestTracingConstants.ContainerAppEnvironmentVariable) != null)
{
hostType = HostType.ContainerApp;
}
else if (Environment.GetEnvironmentVariable(RequestTracingConstants.KubernetesEnvironmentVariable) != null)
{
hostType = HostType.Kubernetes;
}
else if (Environment.GetEnvironmentVariable(RequestTracingConstants.ServiceFabricEnvironmentVariable) != null)
{
hostType = HostType.ServiceFabric;
}
else
{
try
{
string processName = Process.GetCurrentProcess().ProcessName;
if (processName != null && processName.Equals(RequestTracingConstants.IISExpressProcessName, StringComparison.OrdinalIgnoreCase))
{
hostType = HostType.IISExpress;
}
}
catch (InvalidOperationException) { }
catch (PlatformNotSupportedException) { }
catch (NotSupportedException) { }
}
}
catch (SecurityException) { }
return hostType;
}