gpt4 book ai didi

azure - 从 azure 2.4 升级到 2.5 现在诊断不起作用

转载 作者:行者123 更新时间:2023-12-01 09:25:17 25 4
gpt4 key购买 nike

我从 azure 工具 2.4 升级到 2.5,现在当我尝试引用 DiagnosticMonitor.GetDefaultInitialConfiguration() 返回的 DiagnosticMonitorConfiguration 时,抛出空引用,例如

DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);

将抛出异常,因为目录为空。根据我在谷歌上搜索到的内容,默认的初始配置存储在新的diagnostics.wadcfgx 文件中,该文件就在那里,看起来像

<?xml version="1.0" encoding="utf-8"?>
<DiagnosticsConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
<DiagnosticMonitorConfiguration overallQuotaInMB="4096">
<DiagnosticInfrastructureLogs />
<Directories>
<IISLogs containerName="wad-iis-logfiles" />
</Directories>
<PerformanceCounters>
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Bytes Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Requests/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Errors Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Applications Running" sampleRate="PT0S" />
</PerformanceCounters>
<WindowsEventLog scheduledTransferPeriod="PT1M">
<DataSource name="Application!*" />
</WindowsEventLog>
<Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Error" />
</DiagnosticMonitorConfiguration>
</WadCfg>
<StorageAccount>mystorageaccount</StorageAccount>
</PublicConfig>
<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="assetmanagerwms" endpoint="https://core.windows.net/" />
</PrivateConfig>
<IsEnabled>true</IsEnabled>
</DiagnosticsConfiguration>

有人知道我错过了什么吗?返回的 DiagnosticMonitorConfiguration 上的所有属性均为 null 或 0。

最佳答案

这是 SDK 2.5 中的重大更改之一:http://msdn.microsoft.com/en-us/library/azure/dn873976.aspx#BKMK_breaking 。基本上不再支持基于代码的诊断配置。从上面的链接:

Diagnostics configuration requires diagnostics.wadcfgx; configuration in code is no longer supported - With the Azure SDK version 2.5, all diagnostics configuration must be done in the XML configuration file diagnostics.wadcfgx, and the diagnostics agent always uses this configuration, whether it is applied through Visual Studio or Azure PowerShell. Any previous code-based diagnostics configuration (for example, using the DiagnosticMonitor API) must be migrated to the diagnostics.wadcfgx file. Code used to configure crash dumps in previous SDKs must also be migrated to the diagnostics.wadcfgx file.

If your Azure SDK version 2.4 project already uses the XML-based diagnostics configuration file diagnostics.wascfg (a recommended best practice), then when you upgrade the project in Visual Studio to target Azure SDK version 2.5, Visual Studio automatically updates the XML configuration file to the new format (diagnostics.wadcfgx). If your project continues to use a code-based configuration, then when it is upgraded to version 2.5, you will get build warnings that reference the deprecated APIs. You can use Visual Studio to configure diagnostics.wadcfgx by right-clicking a role in Solution Explorer, and then click Properties. On the Configuration tab, select Enable Diagnostics, and then click Configure. See Configuring Diagnostics for Azure Cloud Services and Virtual Machines for more information.

关于azure - 从 azure 2.4 升级到 2.5 现在诊断不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27156946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com