2014-10-05 48 views
0

我正在运行VS 2013 Update 3并安装了带有App Insights的Cloud Service。这一切都很好,很好。但是,我有三种不同的订阅(开发,暂存和生产),并希望我的开发云服务实例向我的开发订阅报告应用程序见解数据,而我的登台云服务实例则将应用程序见解数据报告给我的登台订阅。我怎样才能配置这个单一的云应用程序来报告数据到不同的订阅和/或应用程序见解应用程序名称?如何通过应用程序洞察支持单个应用程序的多个Azure订阅

回答

1

我结束了会内的下列:

public class ConfigSettings 
{ 
    internal class AppInsights 
    { 
     internal static bool IsEnabled 
     { 
      get 
      { 
       return CloudConfigurationManager.GetSetting("AppInsights.IsEnabled").Cast<bool>(); 
      } 
     } 

     internal static string InstrumentationKey 
     { 
      get 
      { 
       return CloudConfigurationManager.GetSetting("AppInsights.InstrumentationKey"); 
      } 
     } 
    } 
} 

public class AppInsightsHelper 
{ 
    public static void Initialize() 
    { 
     if(ConfigSettings.AppInsights.IsEnabled) 
      TelemetryConfiguration.Active.InstrumentationKey = ConfigSettings.AppInsights.InstrumentationKey; 
    } 
} 

// In global.asax.cs 
AppInsightsHelper.Initialize();