2014-10-05 47 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();