c# - 诊断在 Azure SDK 2.5.1 的 Web 角色中不起作用

标签 c# azure azure-web-roles azure-cloud-services azure-diagnostics

我正在使用 Azure SDK 2.5.1,主要是新设计的诊断内容。但是,我发现我无法让它为我的网络角色运行。

因此,我创建了一个云服务项目,添加了一个Web角色。然后,我在 Global.asax.cs 中的 Application_Start 末尾附加了一条跟踪消息:

Trace.TraceInformaction("Application_Start end.");

之后,我右键单击 WebRole 并打开 Properties 选项卡。在诊断配置窗口中:

  • 常规:我选择“自定义计划”,还指定了存储帐户,将“磁盘配额(MB)”保留为默认'4096'
  • 应用日志:“日志级别”切换为“全部”,其他保持默认
  • 其他选项卡采用默认配置设置

将项目部署到云端后,我发现了一些意想不到的事情:

  • 表存储中不存在 WADLogsTable。这很奇怪,如果我使用辅助角色,它会按预期工作。那么在网络角色中,我只是找不到跟踪日志记录?
  • 对于性能计数器,由于我使用的是具有 8 个计数器的默认配置,因此我只能在 WADPerformanceCountersTable 表存储中看到 8 个计数器。在我的假设中,随着时间的推移,这 8 个计数器的值将会越来越多地转移到该表中。但事情并没有发生,几个小时后,它仍然有那 8 个计数器值。

我只是认为 Web 角色的诊断刚刚崩溃或根本不起作用。同时,我检查了服务器中位于 "C:\Logs\Plugins\Microsoft.Azure.Diagnostics.PaaSDiagnostics\1.4.0.0\DiagnosticsPlugin.log" 的日志,在该文件的末尾有异常表示某些诊断进程退出:

DiagnosticsPlugin.exe Error: 0 : [4/25/2015 5:38:21 AM] System.ArgumentException: An item with the same key has already been added.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Microsoft.Azure.Plugins.Diagnostics.dll.PluginConfigurationSettingsProvider.LoadWadXMLConfig(String fullConfig)
DiagnosticsPlugin.exe Error: 0 : [4/25/2015 5:38:21 AM] Failed to load configuration file
DiagnosticsPlugin.exe Information: 0 : [4/25/2015 5:38:21 AM] DiagnosticPlugin.exe exit with code -105

来自MSDN ,代码-105表示:

The Diagnostics plugin cannot open the Diagnostics configuration file.

This is an internal error that should only happen if the Diagnostics plugin is manually invoked, incorrectly, on the VM.

这没有意义,我没有对虚拟机执行任何操作。

正如我上面所说,我只是对 Visual Studio 2013 生成的脚手架代码做了非常小的更改。我是否做错了什么,或者这是 Azure SDK 2.5 的错误?

顺便说一句,对于 worker 角色来说似乎一切都很好。

最佳答案

引自MSDN forum :

Hey folks jumping it late here but just wanted to confirm that there was an issue with the initial 1.4.0.0 diagnostics extension where the plugin could crash on the web role under certain circumstances.

The issue has since been resolved with 1.4.1.0. If you re-apply the extension on the role you should automatically get the latest version which fixes the issue.

在早期阶段,SDK 2.5.1 中的诊断存在一些内部问题,但 Microsoft 已经修复了它。

无论如何,我们有更新的版本可以应用,所以这不再是问题,以防万一您也遇到这个问题。

关于c# - 诊断在 Azure SDK 2.5.1 的 Web 角色中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29862367/

相关文章:

Azure函数: make schedule cron a variable in function. json

javascript - 使用 REST API 将流上传到 Azure Blob 存储,无需 Azure SDK

asp.net - 在window azure中更改web.config的权限

c# - WindowsAzure : Add directory to %path% environment variable when a webrole starts

azure - 带有证书的 HttpRequest 在 Azure Web 角色中失败

c# - 具有 Active Directory 身份验证的 User.IsInRole

c# - .NET C# socket 在两个不同的线程上发送

C# 通过预加载来优化函数

c# - 用于排除 DBNull.Value 的 Filer DataTable

c# - 在 Azure 中设置 ASP.NET Core Web 应用程序的 SQL 连接字符串