2

好的,我一直在這個問題上徘徊一段時間,我想問問以前是否有人遇到過這個問題。Azure Diagnostics不會將IIS日誌傳輸到Blob存儲區

我的配置和設置如下。這是在部署到臨時環境時。 我知道日誌記錄正在發生,因爲我啓用了RDP,並且能夠進入,並且可以看到創建的IIS日誌。但是,即使其他診斷日誌沒有問題,它們也不會傳輸到blob存儲。

在基礎設施日誌,我可以看到下面的錯誤,我聽說是隻有代理和不相關:

WinHttpGetProxyForUrl(http://mystorage.blob.core.windows.net) failed ERROR_WINHTTP_AUTODETECTION_FAILED (12180) 

其他警告我在事件查看器中看到的是:

-<Event> 
-<System> 
<Provider Name="Microsoft-Windows-IIS-W3SVC-WP"Guid="{670080D9-742A-4187-8D16-41143D1290BD}"EventSourceName="W3SVC-WP"/> 
<EventID Qualifiers="32768">2283</EventID> 
<Version>0</Version> 
<Level>3</Level> 
<Task>0</Task> 
<Opcode>0</Opcode> 
<Keywords>0x80000000000000</Keywords> 
<TimeCreated SystemTime="2011-02-18T22:46:34.000Z"/> 
<EventRecordID>266</EventRecordID> 
<Correlation/> 
<Execution ProcessID="0"ThreadID="0"/> 
<Channel>Application</Channel> 
<Computer>RD00155D3273B5</Computer> 
<Security/> 
</System> 
-<EventData> 
<Data Name="FailureCount">3</Data> 
<Data Name="Minutes">5</Data> 
<Data Name="Directory">\\?\C:\Resources\directory\345345kjh325kj5432452345.MyWebRole.DiagnosticStore\FailedReqLogFiles\Web\W3SVC1273337584\</Data> 
<Binary>03000780</Binary> 
</EventData> 
</Event> 

這是一個相當簡單的WCF應用程序,作爲WebRole運行。 的配置是這樣的:

<system.diagnostics> 
      <sources> 
       <source name="System.ServiceModel" switchValue="Information,ActivityTracing" propagateActivity="false"> 
        <listeners> 
         <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="ModelListener"> 
          <filter type="" /> 
         </add> 
        </listeners> 
       </source> 
       <source name="System.ServiceModel.MessageLogging" switchValue="Information" propagateActivity="false"> 
        <listeners> 
         <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="MessageListener"> 
          <filter type="" /> 
         </add> 
        </listeners> 
       </source> 
      </sources> 
      <sharedListeners>    
      </sharedListeners> 
      <trace autoflush="true" indentsize="3"> 
       <listeners> 
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="TraceListener"> 
         <filter type="" /> 
        </add> 
       </listeners> 
      </trace>    
     </system.diagnostics> 
... 
... 
<system.webServer> 
     <modules runAllManagedModulesForAllRequests="true" /> 
     <tracing> 
      <traceFailedRequests> 

       <add path="*"> 
        <traceAreas> 
         <add provider="ASP" verbosity="Verbose" /> 
         <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" /> 
         <add provider="ISAPI Extension" verbosity="Verbose" /> 
         <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" /> 
        </traceAreas> 
        <failureDefinitions verbosity="Warning" statusCodes="400-599" /> 
       </add> 
      </traceFailedRequests> 
     </tracing> 
    </system.webServer> 

我也改變了聽衆的幾個不同的方式,以相同的結果。所以,我不認爲這就是問題了,但是我願意接受建議

在webrole的代碼看起來是這樣的:

public override bool OnStart() 
     { 

      // To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config 
      DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration(); 
      //Windows Performance Counters 

      List<string> counters = new List<string>(); 
      counters.Add(@"\Processor(_Total)\% Processor Time"); 
      counters.Add(@"\Memory\Available Mbytes"); 
      counters.Add(@"\TCPv4\Connections Established"); 
      counters.Add(@"\ASP.NET Applications(__Total__)\Requests/Sec"); 
      counters.Add(@"\Network Interface(*)\Bytes Received/sec"); 
      counters.Add(@"\Network Interface(*)\Bytes Sent/sec"); 

      foreach (string counter in counters) 
      { 
       PerformanceCounterConfiguration counterConfig = new PerformanceCounterConfiguration(); 
       counterConfig.SampleRate = TimeSpan.FromMinutes(1); 
       counterConfig.CounterSpecifier = counter; 
       config.PerformanceCounters.DataSources.Add(counterConfig); 
      } 

      config.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 

      //Windows Event Logs 
      config.WindowsEventLog.DataSources.Add("System!*"); 
      config.WindowsEventLog.DataSources.Add("Application!*"); 
      config.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 
      config.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Error; 

      //Azure Trace Logs 
      config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 
      config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Error; 

      //Crash Dumps 
      CrashDumps.EnableCollection(true); 

      //IIS Logs 
      //This was added in a desperation move but it has not made a difference with or without 
      DirectoryConfiguration directory = new DirectoryConfiguration(); 
      directory.Container = "wad-tracefiles"; 
      directory.DirectoryQuotaInMB = 10; 
      directory.Path = RoleEnvironment.GetLocalResource("AppLocalStorage.svclog").RootPath; 

      config.Directories.DataSources.Add(directory); 
      //end desperation move 
      config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 

      //infrastructure logs 
      config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 
      config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Error; 

      DiagnosticMonitor.Start("DiagnosticsConnectionString", config); 

      // For information on handling configuration changes 
      // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. 
      RoleEnvironment.Changing += new EventHandler<RoleEnvironmentChangingEventArgs>(RoleEnvironment_Changing); 

      // This code is necessary to use CloudStorageAccount.FromConfigurationSetting 
      CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => 
      { 
       configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); 
       RoleEnvironment.Changed += (sender, arg) => 
       { 
        if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>() 
         .Any((change) => (change.ConfigurationSettingName == configName))) 
        { 
         if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))) 
         { 
          RoleEnvironment.RequestRecycle(); 
         } 
        } 
       }; 
      }); 


      return base.OnStart(); 

     } 

DiagnosticsConnectionString是否正確設置爲某些表和容器創建和填充正確。

任何幫助表示讚賞。 在此先感謝。

回答

3

這是Azure SDK 1.3中的一個已知問題。請通過這個博客帖子的解決方法:http://robindotnet.wordpress.com/2011/02/16/azure-toolssdk-1-3-and-iis-logging/

+0

謝謝高拉夫,我已經讀過關於這個「解決方案」的地方,但沒有鏈接。所以這有助於。然而,在其他地方並不十分清楚,這是一個已知的錯誤。我跟蹤也有同樣的問題,根本沒有存儲的痕跡。 – Victor 2011-02-19 13:52:33

+0

Hi Victor:那麼你可以看到性能計數器數據和事件日誌數據,但不能跟蹤日誌數據?可能是這些鏈接可以幫助: http://blog.bareweb.eu/2011/01/updating-azure-diagnostics-to-sdk-v1-3/ http://blog.bareweb.eu/2011/01 /實施azure-diagnostics-with-sdk-v1-3/ – 2011-02-19 14:01:46